diff --git a/.github/workflows/apt-deps.txt b/.github/workflows/apt-deps.txt index 2a12d368c..a6593e4de 100644 --- a/.github/workflows/apt-deps.txt +++ b/.github/workflows/apt-deps.txt @@ -1 +1 @@ -libsdl2-dev libsdl2-net-dev libpng-dev libglew-dev ninja-build +libsdl2-dev libsdl2-net-dev libpng-dev libglew-dev ninja-build libzip-dev zipcmp zipmerge ziptool \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a127d73f..338a172b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,6 +45,21 @@ jobs: make -j sudo make install sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/ + - name: Install latest libzip + if: ${{ (matrix.os == 'ubuntu-20.04' && !vars.LINUX_COMPATIBILITY_RUNNER) }} + run: | + sudo apt-get remove libzip-dev zipcmp zipmerge ziptool + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + if [ ! -d "libzip-1.10.1" ]; then + wget https://libzip.org/download/libzip-1.10.1.tar.gz + tar -xzvf libzip-1.10.1.tar.gz + fi + cd libzip-1.10.1 + mkdir build + cd build + cmake .. + make + sudo make install - name: Download Rom run: | url="${{ secrets.BASEROM }}" diff --git a/.gitignore b/.gitignore index f750e6eb4..68efcecbc 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,5 @@ mm/libultraship/extern/StrHash64.dir/Debug/StrHash64.tlog/Lib.command.1.tlog /Release .vs/* /x64 + +/mm/src/boot/build.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 18a0f1c55..9ebd540d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ elseif ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") set(VCPKG_TARGET_TRIPLET x64-windows-static) endif() vcpkg_bootstrap() -vcpkg_install_packages(zlib bzip2 libpng sdl2 sdl2-net glew glfw3) +vcpkg_install_packages(zlib bzip2 libpng sdl2 sdl2-net glew glfw3 libzip) endif() ################################################################################ @@ -132,7 +132,7 @@ add_custom_target( ExtractAssets # CMake versions prior to 3.17 do not have the rm command, use remove instead for older versions COMMAND ${CMAKE_COMMAND} -E $,remove,rm> -f mm.otr soh.otr - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$" --non-interactive + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$" --non-interactive --xml-root ../mm/assets/xml --custom-otr-file soh.otr "--custom-assets-path" ${CMAKE_CURRENT_SOURCE_DIR}/mm/assets/custom --port-ver "${CMAKE_PROJECT_VERSION}" COMMAND ${CMAKE_COMMAND} -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DTARGET_DIR="$" -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DBINARY_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/copy-existing-otrs.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter COMMENT "Running asset extraction..." @@ -143,7 +143,7 @@ add_custom_target( # Target to generate headers add_custom_target( ExtractAssetHeaders - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$" --non-interactive --gen-headers + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$" --non-interactive --xml-root ../mm/assets/xml --gen-headers WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter COMMENT "Generating asset headers..." DEPENDS ZAPD @@ -154,7 +154,7 @@ add_custom_target( GenerateSohOtr # CMake versions prior to 3.17 do not have the rm command, use remove instead for older versions COMMAND ${CMAKE_COMMAND} -E $,remove,rm> -f soh.otr - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$" --norom + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$" --norom --custom-otr-file soh.otr "--custom-assets-path" ${CMAKE_CURRENT_SOURCE_DIR}/mm/assets/custom --port-ver "${CMAKE_PROJECT_VERSION}" COMMAND ${CMAKE_COMMAND} -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DTARGET_DIR="$" -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DBINARY_DIR=${CMAKE_BINARY_DIR} -DONLYSOHOTR=On -P ${CMAKE_CURRENT_SOURCE_DIR}/copy-existing-otrs.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter COMMENT "Generating soh.otr..." diff --git a/OTRExporter b/OTRExporter index 2e378fe44..5c48f3411 160000 --- a/OTRExporter +++ b/OTRExporter @@ -1 +1 @@ -Subproject commit 2e378fe443aba5e32d8975c9f06b2fa5f1991c2c +Subproject commit 5c48f3411cd404c3ad1a945d7f7cd10d41cb5e4a diff --git a/ZAPDTR b/ZAPDTR index 01ed7e87f..a406a7d43 160000 --- a/ZAPDTR +++ b/ZAPDTR @@ -1 +1 @@ -Subproject commit 01ed7e87f2b4b8145d8b0af8c8d8912b86f4b908 +Subproject commit a406a7d4310c26f6e7aeece3bb4475cd8fd2d9e3 diff --git a/libultraship b/libultraship index 87d3a14cb..e40c19e99 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 87d3a14cb433c499014ff810191fe83673dc69e2 +Subproject commit e40c19e992073e1cde514ad1c4272c08b85b9708 diff --git a/mm/2s2h/BenGui/BenMenuBar.cpp b/mm/2s2h/BenGui/BenMenuBar.cpp index 24f4372fc..25e650c8d 100644 --- a/mm/2s2h/BenGui/BenMenuBar.cpp +++ b/mm/2s2h/BenGui/BenMenuBar.cpp @@ -30,7 +30,6 @@ static const std::unordered_map textureFilteringMap = { static const std::unordered_map audioBackendsMap = { { LUS::AudioBackend::WASAPI, "Windows Audio Session API" }, - { LUS::AudioBackend::PULSE, "PulseAudio" }, { LUS::AudioBackend::SDL, "SDL" }, }; diff --git a/mm/2s2h/BenPort.cpp b/mm/2s2h/BenPort.cpp index d2de391a4..0c5c1936d 100644 --- a/mm/2s2h/BenPort.cpp +++ b/mm/2s2h/BenPort.cpp @@ -59,6 +59,7 @@ CrowdControl* CrowdControl::Instance; #include "2s2h/Enhancements/GfxPatcher/AuthenticGfxPatches.h" // Resource Types/Factories +#include "2s2h/resource//type/2shResourceType.h" #include "2s2h/resource/type/Animation.h" #include "2s2h/resource/type/AudioSample.h" #include "2s2h/resource/type/AudioSequence.h" @@ -70,7 +71,6 @@ CrowdControl* CrowdControl::Instance; #include "2s2h/resource/type/Scene.h" #include "2s2h/resource/type/Skeleton.h" #include "2s2h/resource/type/SkeletonLimb.h" -#include "2s2h/resource/type/Text.h" #include "2s2h/resource/importer/AnimationFactory.h" #include "2s2h/resource/importer/AudioSampleFactory.h" #include "2s2h/resource/importer/AudioSequenceFactory.h" @@ -82,7 +82,6 @@ CrowdControl* CrowdControl::Instance; #include "2s2h/resource/importer/SceneFactory.h" #include "2s2h/resource/importer/SkeletonFactory.h" #include "2s2h/resource/importer/SkeletonLimbFactory.h" -#include "2s2h/resource/importer/TextFactory.h" #include "2s2h/resource/importer/TextMMFactory.h" #include "2s2h/resource/importer/BackgroundFactory.h" #include "2s2h/resource/importer/TextureAnimationFactory.h" @@ -130,42 +129,44 @@ OTRGlobals::OTRGlobals() { // tell LUS to reserve 3 SoH specific threads (Game, Audio, Save) context = LUS::Context::CreateInstance("2 Ship 2 Harkinian", appShortName, "shipofharkinian.json", OTRFiles, {}, 3); //context = LUS::Context::CreateUninitializedInstance("Ship of Harkinian", appShortName, "shipofharkinian.json"); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_Animation, "Animation", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_PlayerAnimation, "PlayerAnimation", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_Room, "Room", std::make_shared()); // Is room scene? maybe? - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_CollisionHeader, "CollisionHeader", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_Skeleton, "Skeleton", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_SkeletonLimb, "SkeletonLimb", std::make_shared()); - // TODO should we use a custom command for this? - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Path, "Path", - std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_Cutscene, "Cutscene", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Text, "Text", - std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_TextMM, "TextMM", - std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_AudioSample, "AudioSample", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_AudioSoundFont, "AudioSoundFont", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_AudioSequence, "AudioSequence", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::SOH_Background, "Background", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::TSH_TexAnim, "TextureAnimation", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::TSH_CKeyFrameAnim, "KeyFrameAnim", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory( - LUS::ResourceType::TSH_CKeyFrameSkel, "KeyFrameSkel", std::make_shared()); - + auto loader = context->GetResourceManager()->GetResourceLoader(); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "Animation", static_cast(SOH::ResourceType::SOH_Animation), 0); + loader->RegisterResourceFactory(std::make_shared(), + RESOURCE_FORMAT_BINARY, "PlayerAnimation", + static_cast(SOH::ResourceType::SOH_PlayerAnimation), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "Room", static_cast(SOH::ResourceType::SOH_Room), 0); + loader + ->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "CollisionHeader", static_cast(SOH::ResourceType::SOH_CollisionHeader), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "Skeleton", static_cast(SOH::ResourceType::SOH_Skeleton), 0); + loader->RegisterResourceFactory(std::make_shared(), + RESOURCE_FORMAT_BINARY, "SkeletonLimb", + static_cast(SOH::ResourceType::SOH_SkeletonLimb), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "Path", static_cast(SOH::ResourceType::SOH_Path), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "Cutscene", static_cast(SOH::ResourceType::SOH_Cutscene), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "TextMM", static_cast(SOH::ResourceType::TSH_TextMM), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "AudioSample", static_cast(SOH::ResourceType::SOH_AudioSample), 2); + loader->RegisterResourceFactory(std::make_shared(), + RESOURCE_FORMAT_BINARY, "AudioSoundFont", + static_cast(SOH::ResourceType::SOH_AudioSoundFont), 2); + loader->RegisterResourceFactory(std::make_shared(), + RESOURCE_FORMAT_BINARY, "AudioSequence", static_cast(SOH::ResourceType::SOH_AudioSequence), 2); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "Background", static_cast(SOH::ResourceType::SOH_Background), 0); + loader->RegisterResourceFactory(std::make_shared(), + RESOURCE_FORMAT_BINARY, "TextureAnimation", + static_cast(SOH::ResourceType::TSH_TexAnim), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "KeyFrameAnim", static_cast(SOH::ResourceType::TSH_CKeyFrameAnim), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "KeyFrameSkel", static_cast(SOH::ResourceType::TSH_CKeyFrameSkel), 0); context->GetControlDeck()->SetSinglePlayerMappingMode(true); //gSaveStateMgr = std::make_shared(); @@ -183,7 +184,7 @@ OTRGlobals::OTRGlobals() { // cameraStrings[i] = dup; //} - auto versions = context->GetResourceManager()->GetArchive()->GetGameVersions(); + auto versions = context->GetResourceManager()->GetArchiveManager()->GetGameVersions(); #if 0 for (uint32_t version : versions) { if (!ValidHashes.contains(version)) { @@ -266,7 +267,7 @@ extern "C" void ResourceMgr_LoadDirectory(const char* resName); std::unordered_map ExtensionCache; extern "C" void OTRExtScanner() { - auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->ListFiles("*").get(); + auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*").get(); for (auto& rPath : lst) { std::vector raw = StringHelper::Split(rPath, "."); @@ -632,15 +633,15 @@ extern "C" uint16_t OTRGetPixelDepth(float x, float y) { } extern "C" uint32_t ResourceMgr_GetNumGameVersions() { - return LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions().size(); + return LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size(); } extern "C" uint32_t ResourceMgr_GetGameVersion(int index) { - return LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index]; + return LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; } extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) { - uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index]; + uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; switch (version) { case OOT_NTSC_US_10: @@ -663,7 +664,7 @@ extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) { } extern "C" uint32_t ResourceMgr_GetGameRegion(int index) { - uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index]; + uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; switch (version) { case OOT_NTSC_US_10: @@ -742,7 +743,7 @@ extern "C" void ResourceMgr_DirtyDirectory(const char* resName) { // OTRTODO: There is probably a more elegant way to go about this... // Kenix: This is definitely leaking memory when it's called. extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) { - auto lst = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->ListFiles(searchMask); + auto lst = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(searchMask); char** result = (char**)malloc(lst->size() * sizeof(char*)); for (size_t i = 0; i < lst->size(); i++) { @@ -806,7 +807,7 @@ extern "C" char* ResourceMgr_LoadFileFromDisk(const char* filePath) { extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) { auto res = GetResourceByNameHandlingMQ(texPath); - return res->GetInitData()->Type == LUS::ResourceType::SOH_Background; + return res->GetInitData()->Type == static_cast(SOH::ResourceType::SOH_Background); } extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize) { @@ -853,9 +854,9 @@ extern "C" uint16_t ResourceMgr_LoadTexHeightByName(char* texPath); extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) { auto res = GetResourceByNameHandlingMQ(filePath); - if (res->GetInitData()->Type == LUS::ResourceType::DisplayList) + if (res->GetInitData()->Type == static_cast(LUS::ResourceType::DisplayList)) return (char*)&((std::static_pointer_cast(res))->Instructions[0]); - else if (res->GetInitData()->Type == LUS::ResourceType::Array) + else if (res->GetInitData()->Type == static_cast(LUS::ResourceType::Array)) return (char*)(std::static_pointer_cast(res))->Vertices.data(); else { return (char*)GetResourceDataByNameHandlingMQ(filePath); @@ -865,7 +866,7 @@ extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) { extern "C" char* ResourceMgr_LoadIfDListByName(const char* filePath) { auto res = GetResourceByNameHandlingMQ(filePath); - if (res->GetInitData()->Type == LUS::ResourceType::DisplayList) + if (res->GetInitData()->Type == static_cast(LUS::ResourceType::DisplayList)) return (char*)&((std::static_pointer_cast(res))->Instructions[0]); return nullptr; @@ -876,7 +877,7 @@ extern "C" char* ResourceMgr_LoadIfDListByName(const char* filePath) { //} extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) { - auto anim = std::static_pointer_cast(GetResourceByNameHandlingMQ(animPath)); + auto anim = std::static_pointer_cast(GetResourceByNameHandlingMQ(animPath)); return (char*)&anim->limbRotData[0]; } @@ -1160,12 +1161,12 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel extern "C" void ResourceMgr_UnregisterSkeleton(SkelAnime* skelAnime) { if (skelAnime != nullptr) - LUS::SkeletonPatcher::UnregisterSkeleton(skelAnime); + SOH::SkeletonPatcher::UnregisterSkeleton(skelAnime); } extern "C" void ResourceMgr_ClearSkeletons(SkelAnime* skelAnime) { if (skelAnime != nullptr) - LUS::SkeletonPatcher::ClearSkeletons(); + SOH::SkeletonPatcher::ClearSkeletons(); } extern "C" s32* ResourceMgr_LoadCSByName(const char* path) { diff --git a/mm/2s2h/Extractor/Extract.cpp b/mm/2s2h/Extractor/Extract.cpp index c2eb096db..61f1291e0 100644 --- a/mm/2s2h/Extractor/Extract.cpp +++ b/mm/2s2h/Extractor/Extract.cpp @@ -7,6 +7,7 @@ #include "Extract.h" #include "portable-file-dialogs.h" #include +#include "build.h" #ifdef unix #include @@ -535,9 +536,10 @@ std::string Extractor::Mkdtemp() { extern "C" int zapd_main(int argc, char** argv); bool Extractor::CallZapd(std::string installPath, std::string exportdir) { - constexpr int argc = 16; + constexpr int argc = 18; char xmlPath[1024]; char confPath[1024]; + char portVersion[18]; // 5 digits for int16_max (x3) + separators + terminator std::array argv; // const char* version = GetZapdVerStr(); const char* otrFile = "mm.otr"; @@ -559,6 +561,7 @@ bool Extractor::CallZapd(std::string installPath, std::string exportdir) { snprintf(xmlPath, 1024, "assets/extractor/xmls"); snprintf(confPath, 1024, "assets/extractor/Config.xml"); + snprintf(portVersion, 18, "%d.%d.%d", gBuildVersionMajor, gBuildVersionMinor, gBuildVersionPatch); argv[0] = "ZAPD"; argv[1] = "ed"; @@ -576,6 +579,8 @@ bool Extractor::CallZapd(std::string installPath, std::string exportdir) { argv[13] = "OTR"; argv[14] = "--otrfile"; argv[15] = otrFile; + argv[16] = "--portVer"; + argv[17] = portVersion; #ifdef _WIN32 // Grab a handle to the command window. @@ -584,6 +589,9 @@ bool Extractor::CallZapd(std::string installPath, std::string exportdir) { // Normally the command window is hidden. We want the window to be shown here so the user can see the progess of the extraction. ShowWindow(cmdWindow, SW_SHOW); SetWindowPos(cmdWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); +#else + // Show extraction in background message until linux/mac can have visual progress + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Extracting", "Extraction will now begin in the background.\n\nPlease be patient for the process to finish. Do not close the main program.", nullptr); #endif zapd_main(argc, (char**)argv.data()); diff --git a/mm/2s2h/resource/importer/AnimationFactory.cpp b/mm/2s2h/resource/importer/AnimationFactory.cpp index c177c8ea9..e59a46f7f 100644 --- a/mm/2s2h/resource/importer/AnimationFactory.cpp +++ b/mm/2s2h/resource/importer/AnimationFactory.cpp @@ -4,32 +4,15 @@ #include #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -AnimationFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Animation with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr +ResourceFactoryBinaryAnimationV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { - std::shared_ptr animation = std::static_pointer_cast(resource); - - ResourceVersionFactory::ParseFileBinary(reader, animation); + auto animation = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); AnimationType animType = (AnimationType)reader->ReadUInt32(); animation->type = animType; @@ -99,10 +82,12 @@ void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr read // Read the segment pointer (always 32 bit, doesn't adjust for system pointer size) std::string path = reader->ReadString(); - - animation->animationData.linkAnimationHeader.segment = ResourceGetDataByName(path.c_str()); + const auto animData = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(path.c_str())); + + animation->animationData.linkAnimationHeader.segment = animData->GetPointer(); } else if (animType == AnimationType::Legacy) { SPDLOG_DEBUG("BEYTAH ANIMATION?!"); } + return animation; } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/AnimationFactory.h b/mm/2s2h/resource/importer/AnimationFactory.h index dee2026f9..37744ee02 100644 --- a/mm/2s2h/resource/importer/AnimationFactory.h +++ b/mm/2s2h/resource/importer/AnimationFactory.h @@ -1,17 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class AnimationFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinaryAnimationV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; -}; - -class AnimationFactoryV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/mm/2s2h/resource/importer/AudioSampleFactory.cpp b/mm/2s2h/resource/importer/AudioSampleFactory.cpp index 73c5af484..a24febba6 100644 --- a/mm/2s2h/resource/importer/AudioSampleFactory.cpp +++ b/mm/2s2h/resource/importer/AudioSampleFactory.cpp @@ -2,33 +2,14 @@ #include "2s2h/resource/type/AudioSample.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -AudioSampleFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 2: - factory = std::make_shared(); - break; +namespace SOH { +std::shared_ptr ResourceFactoryBinaryAudioSampleV2::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; } - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load AudioSample with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr audioSample = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, audioSample); + auto audioSample = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); audioSample->sample.codec = reader->ReadUByte(); audioSample->sample.medium = reader->ReadUByte(); @@ -65,9 +46,10 @@ void LUS::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr re } audioSample->book.book = audioSample->bookData.data(); audioSample->sample.book = &audioSample->book; -} -} // namespace LUS + return audioSample; +} +} // namespace SOH /* in ResourceMgr_LoadAudioSample we used to have diff --git a/mm/2s2h/resource/importer/AudioSampleFactory.h b/mm/2s2h/resource/importer/AudioSampleFactory.h index 6e9ddc17c..2680ccdc2 100644 --- a/mm/2s2h/resource/importer/AudioSampleFactory.h +++ b/mm/2s2h/resource/importer/AudioSampleFactory.h @@ -1,19 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class AudioSampleFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryAudioSampleV2 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class AudioSampleFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/AudioSequenceFactory.cpp b/mm/2s2h/resource/importer/AudioSequenceFactory.cpp index 20c5df8a3..b1c604831 100644 --- a/mm/2s2h/resource/importer/AudioSequenceFactory.cpp +++ b/mm/2s2h/resource/importer/AudioSequenceFactory.cpp @@ -2,33 +2,14 @@ #include "2s2h/resource/type/AudioSequence.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -AudioSequenceFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 2: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr audioSequence = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, audioSequence); + auto audioSequence = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); audioSequence->sequence.seqDataSize = reader->ReadInt32(); audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize); @@ -48,5 +29,7 @@ void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr for (uint32_t i = 0; i < audioSequence->sequence.numFonts; i++) { audioSequence->sequence.fonts[i] = reader->ReadUByte(); } + + return audioSequence; } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/AudioSequenceFactory.h b/mm/2s2h/resource/importer/AudioSequenceFactory.h index 12b3809aa..fb4391d61 100644 --- a/mm/2s2h/resource/importer/AudioSequenceFactory.h +++ b/mm/2s2h/resource/importer/AudioSequenceFactory.h @@ -1,19 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class AudioSequenceFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryAudioSequenceV2 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class AudioSequenceFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp b/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp index 4ccb7edad..6fee8ec87 100644 --- a/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp +++ b/mm/2s2h/resource/importer/AudioSoundFontFactory.cpp @@ -3,33 +3,14 @@ #include "spdlog/spdlog.h" #include "libultraship/libultraship.h" -namespace LUS { -std::shared_ptr -AudioSoundFontFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 2: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr audioSoundFont = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont); + auto audioSoundFont = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); audioSoundFont->soundFont.fntIndex = reader->ReadInt32(); audioSoundFont->medium = reader->ReadInt8(); @@ -186,5 +167,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr audioSoundFont->soundEffects.push_back(soundEffect); } audioSoundFont->soundFont.soundEffects = audioSoundFont->soundEffects.data(); + + return audioSoundFont; } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/AudioSoundFontFactory.h b/mm/2s2h/resource/importer/AudioSoundFontFactory.h index 7dd5bc0d5..a63533db9 100644 --- a/mm/2s2h/resource/importer/AudioSoundFontFactory.h +++ b/mm/2s2h/resource/importer/AudioSoundFontFactory.h @@ -1,19 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class AudioSoundFontFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryAudioSoundFontV2 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class AudioSoundFontFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/AudioSoundFontFactory.h.1 b/mm/2s2h/resource/importer/AudioSoundFontFactory.h.1 new file mode 100644 index 000000000..a63533db9 --- /dev/null +++ b/mm/2s2h/resource/importer/AudioSoundFontFactory.h.1 @@ -0,0 +1,11 @@ +#pragma once + +#include "Resource.h" +#include "ResourceFactoryBinary.h" + +namespace SOH { +class ResourceFactoryBinaryAudioSoundFontV2 : public LUS::ResourceFactoryBinary { + public: + std::shared_ptr ReadResource(std::shared_ptr file) override; +}; +} // namespace SOH diff --git a/mm/2s2h/resource/importer/BackgroundFactory.cpp b/mm/2s2h/resource/importer/BackgroundFactory.cpp index 6acc7737c..3c430bf51 100644 --- a/mm/2s2h/resource/importer/BackgroundFactory.cpp +++ b/mm/2s2h/resource/importer/BackgroundFactory.cpp @@ -2,31 +2,14 @@ #include "2s2h/resource/type/Background.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -BackgroundFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Background with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryBackgroundV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { - std::shared_ptr background = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, background); + auto background = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); uint32_t dataSize = reader->ReadUInt32(); @@ -35,5 +18,7 @@ void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr reader, for (uint32_t i = 0; i < dataSize; i++) { background->Data.push_back(reader->ReadUByte()); } + + return background; } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/BackgroundFactory.h b/mm/2s2h/resource/importer/BackgroundFactory.h index 9767fdf8b..787ee509c 100644 --- a/mm/2s2h/resource/importer/BackgroundFactory.h +++ b/mm/2s2h/resource/importer/BackgroundFactory.h @@ -1,17 +1,11 @@ #pragma once #include "resource/Resource.h" -#include "resource/ResourceFactory.h" +#include "resource/ResourceFactoryBinary.h" -namespace LUS { -class BackgroundFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinaryBackgroundV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class BackgroundFactoryV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/CollisionHeaderFactory.cpp b/mm/2s2h/resource/importer/CollisionHeaderFactory.cpp index 4b5b45f0d..e517f3bbf 100644 --- a/mm/2s2h/resource/importer/CollisionHeaderFactory.cpp +++ b/mm/2s2h/resource/importer/CollisionHeaderFactory.cpp @@ -2,33 +2,14 @@ #include "2s2h/resource/type/CollisionHeader.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -CollisionHeaderFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryCollisionHeaderV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr collisionHeader = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, collisionHeader); + auto collisionHeader = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); collisionHeader->collisionHeaderData.minBounds.x = reader->ReadInt16(); collisionHeader->collisionHeaderData.minBounds.y = reader->ReadInt16(); @@ -138,5 +119,129 @@ void LUS::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptrwaterBoxes.push_back(waterBox); } collisionHeader->collisionHeaderData.waterBoxes = collisionHeader->waterBoxes.data(); + + return collisionHeader; } + +std::shared_ptr ResourceFactoryXMLCollisionHeaderV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto collisionHeader = std::make_shared(file->InitData); + + auto reader = std::get>(file->Reader)->FirstChildElement(); + auto child = reader->FirstChildElement(); + + collisionHeader->collisionHeaderData.minBounds.x = reader->IntAttribute("MinBoundsX"); + collisionHeader->collisionHeaderData.minBounds.y = reader->IntAttribute("MinBoundsY"); + collisionHeader->collisionHeaderData.minBounds.z = reader->IntAttribute("MinBoundsZ"); + + collisionHeader->collisionHeaderData.maxBounds.x = reader->IntAttribute("MaxBoundsX"); + collisionHeader->collisionHeaderData.maxBounds.y = reader->IntAttribute("MaxBoundsY"); + collisionHeader->collisionHeaderData.maxBounds.z = reader->IntAttribute("MaxBoundsZ"); + + Vec3s zero; + zero.x = 0; + zero.y = 0; + zero.z = 0; + collisionHeader->camPosDataZero = zero; + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "Vertex") { + Vec3s vtx; + vtx.x = child->IntAttribute("X"); + vtx.y = child->IntAttribute("Y"); + vtx.z = child->IntAttribute("Z"); + collisionHeader->vertices.push_back(vtx); + } else if (childName == "Polygon") { + CollisionPoly polygon; + + polygon.type = child->UnsignedAttribute("Type"); + + polygon.flags_vIA = child->UnsignedAttribute("VertexA"); + polygon.flags_vIB = child->UnsignedAttribute("VertexB"); + polygon.vIC = child->UnsignedAttribute("VertexC"); + + polygon.normal.x = child->IntAttribute("NormalX"); + polygon.normal.y = child->IntAttribute("NormalY"); + polygon.normal.z = child->IntAttribute("NormalZ"); + + polygon.dist = child->IntAttribute("Dist"); + + collisionHeader->polygons.push_back(polygon); + } else if (childName == "PolygonType") { + SurfaceType surfaceType; + + surfaceType.data[0] = child->UnsignedAttribute("Data1"); + surfaceType.data[1] = child->UnsignedAttribute("Data2"); + + collisionHeader->surfaceTypes.push_back(surfaceType); + } else if (childName == "CameraData") { + CamData camDataEntry; + camDataEntry.cameraSType = child->UnsignedAttribute("SType"); + camDataEntry.numCameras = child->IntAttribute("NumData"); + collisionHeader->camData.push_back(camDataEntry); + + int32_t camPosDataIdx = child->IntAttribute("CameraPosDataSeg"); + collisionHeader->camPosDataIndices.push_back(camPosDataIdx); + } else if (childName == "CameraPositionData") { + //each camera position data is made up of 3 Vec3s + Vec3s pos; + pos.x = child->IntAttribute("PosX"); + pos.y = child->IntAttribute("PosY"); + pos.z = child->IntAttribute("PosZ"); + collisionHeader->camPosData.push_back(pos); + Vec3s rot; + rot.x = child->IntAttribute("RotX"); + rot.y = child->IntAttribute("RotY"); + rot.z = child->IntAttribute("RotZ"); + collisionHeader->camPosData.push_back(rot); + Vec3s other; + other.x = child->IntAttribute("FOV"); + other.y = child->IntAttribute("JfifID"); + other.z = child->IntAttribute("Unknown"); + collisionHeader->camPosData.push_back(other); + } else if (childName == "WaterBox") { + WaterBox waterBox; + waterBox.xMin = child->IntAttribute("XMin"); + waterBox.ySurface = child->IntAttribute("Ysurface"); + waterBox.zMin = child->IntAttribute("ZMin"); + waterBox.xLength = child->IntAttribute("XLength"); + waterBox.zLength = child->IntAttribute("ZLength"); + waterBox.properties = child->IntAttribute("Properties"); + + collisionHeader->waterBoxes.push_back(waterBox); + } + + child = child->NextSiblingElement(); + } + + for (size_t i = 0; i < collisionHeader->camData.size(); i++) { + int32_t idx = collisionHeader->camPosDataIndices[i]; + + if (collisionHeader->camPosData.size() > 0) { + collisionHeader->camData[i].camPosData = &collisionHeader->camPosData[idx]; + } else { + collisionHeader->camData[i].camPosData = &collisionHeader->camPosDataZero; + } + } + + collisionHeader->collisionHeaderData.numVertices = collisionHeader->vertices.size(); + collisionHeader->collisionHeaderData.numPolygons = collisionHeader->polygons.size(); + collisionHeader->surfaceTypesCount = collisionHeader->surfaceTypes.size(); + collisionHeader->camDataCount = collisionHeader->camData.size(); + collisionHeader->camPosCount = collisionHeader->camPosData.size(); + collisionHeader->collisionHeaderData.numWaterBoxes = collisionHeader->waterBoxes.size(); + + collisionHeader->collisionHeaderData.vtxList = collisionHeader->vertices.data(); + collisionHeader->collisionHeaderData.polyList = collisionHeader->polygons.data(); + collisionHeader->collisionHeaderData.surfaceTypeList = collisionHeader->surfaceTypes.data(); + collisionHeader->collisionHeaderData.cameraDataList = collisionHeader->camData.data(); + collisionHeader->collisionHeaderData.cameraDataListLen = collisionHeader->camDataCount; + collisionHeader->collisionHeaderData.waterBoxes = collisionHeader->waterBoxes.data(); + + return collisionHeader; } +} // namespace SOH diff --git a/mm/2s2h/resource/importer/CollisionHeaderFactory.h b/mm/2s2h/resource/importer/CollisionHeaderFactory.h index 09d6ba4c5..abd878909 100644 --- a/mm/2s2h/resource/importer/CollisionHeaderFactory.h +++ b/mm/2s2h/resource/importer/CollisionHeaderFactory.h @@ -1,17 +1,17 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" +#include "ResourceFactoryXML.h" -namespace LUS { -class CollisionHeaderFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinaryCollisionHeaderV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class CollisionHeaderFactoryV0 : public ResourceVersionFactory { +class ResourceFactoryXMLCollisionHeaderV0 : public LUS::ResourceFactoryXML { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/CutsceneFactory.cpp b/mm/2s2h/resource/importer/CutsceneFactory.cpp index be06b316f..0d76f3103 100644 --- a/mm/2s2h/resource/importer/CutsceneFactory.cpp +++ b/mm/2s2h/resource/importer/CutsceneFactory.cpp @@ -243,36 +243,16 @@ typedef enum { /* -1 */ CS_CAM_STOP // OoT Remnant } CutsceneCmd; -namespace LUS { -std::shared_ptr CutsceneFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; +namespace SOH { - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Cutscene with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -static inline uint32_t read_CMD_BBBB(std::shared_ptr reader) { +static inline uint32_t read_CMD_BBBB(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); return v; } -static inline uint32_t read_CMD_BBH(std::shared_ptr reader) { +static inline uint32_t read_CMD_BBH(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); @@ -287,7 +267,7 @@ static inline uint32_t read_CMD_BBH(std::shared_ptr reader) { return v; } -static inline uint32_t read_CMD_HBB(std::shared_ptr reader) { +static inline uint32_t read_CMD_HBB(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); @@ -302,7 +282,7 @@ static inline uint32_t read_CMD_HBB(std::shared_ptr reader) { return v; } -static inline uint32_t read_CMD_HH(std::shared_ptr reader) { +static inline uint32_t read_CMD_HH(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); @@ -320,10 +300,13 @@ static inline uint32_t read_CMD_HH(std::shared_ptr reader) { return v; } -void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr cutscene = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, cutscene); +std::shared_ptr ResourceFactoryBinaryCutsceneV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto cutscene = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); uint32_t numEntries = reader->ReadUInt32(); cutscene->commands.reserve(numEntries); @@ -335,9 +318,161 @@ void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr reade cutscene->commands.push_back(cutscene->endFrame); // BENTODO detect the game - ParseFileBinaryMM(reader, cutscene); + while (true) { + uint32_t command = reader->ReadUInt32(); + cutscene->commands.push_back(command); + + if (((command >= CS_CMD_ACTOR_CUE_100) && (command <= CS_CMD_ACTOR_CUE_149)) || + (command == CS_CMD_ACTOR_CUE_201) || + ((command >= CS_CMD_ACTOR_CUE_450) && (command <= CS_CMD_ACTOR_CUE_599))) { + goto actorCue; + } + + switch (command) { + case CS_CMD_TEXT: { + uint32_t size = reader->ReadUInt32(); + cutscene->commands.push_back(size); + + for (uint32_t i = 0; i < size; i++) { + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HH(reader)); + } + break; + } + case CS_CMD_CAMERA_SPLINE: { + uint32_t size = reader->ReadUInt32(); + cutscene->commands.push_back(size); + + while (1) { + // We need to store the first half of the header to get the number of entries. + uint32_t header1 = read_CMD_HH(reader); + + uint32_t numEntries = header1 & 0xFFFF; + + cutscene->commands.push_back(header1); + if (numEntries == 0xFFFF) { + break; // Last command is HH(0xFFFF, 0004) which was already read in and pushed into the vector + } + cutscene->commands.push_back(read_CMD_HH(reader)); + + for (size_t j = 0; j < numEntries * 2; j++) { + cutscene->commands.push_back(read_CMD_BBH(reader)); + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HH(reader)); + } + + for (size_t j = 0; j < numEntries; j++) { + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HH(reader)); + } + } + + // for (uint32_t i = 0; i < (size / 4); i++) { + + // cutscene->commands.push_back(read_CMD_HH(reader)); + //} + break; + } + case CS_CMD_MISC: + case CS_CMD_LIGHT_SETTING: + case CS_CMD_TRANSITION: + case CS_CMD_MOTION_BLUR: + case CS_CMD_GIVE_TATL: + case CS_CMD_START_SEQ: + case CS_CMD_STOP_SEQ: + case CS_CMD_SFX_REVERB_INDEX_2: + case CS_CMD_SFX_REVERB_INDEX_1: + case CS_CMD_MODIFY_SEQ: + case CS_CMD_START_AMBIENCE: + case CS_CMD_FADE_OUT_AMBIENCE: + case CS_CMD_DESTINATION: + case CS_CMD_CHOOSE_CREDITS_SCENES: + default: { + uint32_t size = reader->ReadUInt32(); + cutscene->commands.push_back(size); + + for (uint32_t i = 0; i < size; i++) { + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HH(reader)); + } + break; + } + case CS_CMD_TRANSITION_GENERAL: { + uint32_t size = reader->ReadUInt32(); + cutscene->commands.push_back(size); + + for (uint32_t i = 0; i < size; i++) { + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HBB(reader)); + cutscene->commands.push_back(read_CMD_BBBB(reader)); + } + break; + } + case CS_CMD_FADE_OUT_SEQ: { + uint32_t size = reader->ReadUInt32(); + cutscene->commands.push_back(size); + + for (uint32_t i = 0; i < size; i++) { + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(reader->ReadUInt32()); + } + break; + } + case CS_CMD_TIME: { + uint32_t size = reader->ReadUInt32(); + cutscene->commands.push_back(size); + + for (uint32_t i = 0; i < size; i++) { + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HBB(reader)); + cutscene->commands.push_back(reader->ReadUInt32()); + } + break; + } + case CS_CMD_PLAYER_CUE: { + actorCue: + uint32_t size = reader->ReadUInt32(); + cutscene->commands.push_back(size); + for (uint32_t i = 0; i < size; i++) { + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(reader->ReadUInt32()); + cutscene->commands.push_back(reader->ReadUInt32()); + cutscene->commands.push_back(reader->ReadUInt32()); + cutscene->commands.push_back(reader->ReadUInt32()); + cutscene->commands.push_back(reader->ReadUInt32()); + cutscene->commands.push_back(reader->ReadUInt32()); + cutscene->commands.push_back(reader->ReadUInt32()); + cutscene->commands.push_back(reader->ReadUInt32()); + cutscene->commands.push_back(reader->ReadUInt32()); + } + break; + } + case CS_CMD_RUMBLE: { + uint32_t size = reader->ReadUInt32(); + cutscene->commands.push_back(size); + + for (uint32_t i = 0; i < size; i++) { + cutscene->commands.push_back(read_CMD_HH(reader)); + cutscene->commands.push_back(read_CMD_HBB(reader)); + cutscene->commands.push_back(read_CMD_BBBB(reader)); + } + break; + } + case 0xFFFFFFFF: { + cutscene->commands.push_back(reader->ReadUInt32()); + return cutscene; + } + } + } + + return cutscene; } +#if 0 void LUS::CutsceneFactoryV0::ParseFileBinaryOoT(std::shared_ptr reader, std::shared_ptr cutscene) { while (true) { @@ -714,159 +849,5 @@ void LUS::CutsceneFactoryV0::ParseFileBinaryOoT(std::shared_ptr re } } } - -void LUS::CutsceneFactoryV0::ParseFileBinaryMM(std::shared_ptr reader, - std::shared_ptr cutscene) { - while (true) { - uint32_t command = reader->ReadUInt32(); - cutscene->commands.push_back(command); - - if (((command >= CS_CMD_ACTOR_CUE_100) && (command <= CS_CMD_ACTOR_CUE_149)) || - (command == CS_CMD_ACTOR_CUE_201) || - ((command >= CS_CMD_ACTOR_CUE_450) && (command <= CS_CMD_ACTOR_CUE_599))) { - goto actorCue; - } - - switch (command) { - case CS_CMD_TEXT: { - uint32_t size = reader->ReadUInt32(); - cutscene->commands.push_back(size); - - for (uint32_t i = 0; i < size; i++) { - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HH(reader)); - } - break; - } - case CS_CMD_CAMERA_SPLINE: { - uint32_t size = reader->ReadUInt32(); - cutscene->commands.push_back(size); - - while (1) { - // We need to store the first half of the header to get the number of entries. - uint32_t header1 = read_CMD_HH(reader); - - uint32_t numEntries = header1 & 0xFFFF; - - cutscene->commands.push_back(header1); - if (numEntries == 0xFFFF) { - break; //Last command is HH(0xFFFF, 0004) which was already read in and pushed into the vector - } - cutscene->commands.push_back(read_CMD_HH(reader)); - - for (size_t j = 0; j < numEntries * 2; j++) { - cutscene->commands.push_back(read_CMD_BBH(reader)); - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HH(reader)); - } - - for (size_t j = 0; j < numEntries; j++) { - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HH(reader)); - } - } - - //for (uint32_t i = 0; i < (size / 4); i++) { - - //cutscene->commands.push_back(read_CMD_HH(reader)); - //} - break; - } - case CS_CMD_MISC: - case CS_CMD_LIGHT_SETTING: - case CS_CMD_TRANSITION: - case CS_CMD_MOTION_BLUR: - case CS_CMD_GIVE_TATL: - case CS_CMD_START_SEQ: - case CS_CMD_STOP_SEQ: - case CS_CMD_SFX_REVERB_INDEX_2: - case CS_CMD_SFX_REVERB_INDEX_1: - case CS_CMD_MODIFY_SEQ: - case CS_CMD_START_AMBIENCE: - case CS_CMD_FADE_OUT_AMBIENCE: - case CS_CMD_DESTINATION: - case CS_CMD_CHOOSE_CREDITS_SCENES: - default: { - uint32_t size = reader->ReadUInt32(); - cutscene->commands.push_back(size); - - for (uint32_t i = 0; i < size; i++) { - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HH(reader)); - } - break; - } - case CS_CMD_TRANSITION_GENERAL: { - uint32_t size = reader->ReadUInt32(); - cutscene->commands.push_back(size); - - for (uint32_t i = 0; i < size; i++) { - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HBB(reader)); - cutscene->commands.push_back(read_CMD_BBBB(reader)); - } - break; - } - case CS_CMD_FADE_OUT_SEQ: { - uint32_t size = reader->ReadUInt32(); - cutscene->commands.push_back(size); - - for (uint32_t i = 0; i < size; i++) { - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(reader->ReadUInt32()); - } - break; - } - case CS_CMD_TIME: { - uint32_t size = reader->ReadUInt32(); - cutscene->commands.push_back(size); - - for (uint32_t i = 0; i < size; i++) { - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HBB(reader)); - cutscene->commands.push_back(reader->ReadUInt32()); - } - break; - } - case CS_CMD_PLAYER_CUE: { - actorCue: - uint32_t size = reader->ReadUInt32(); - cutscene->commands.push_back(size); - for (uint32_t i = 0; i < size; i++) { - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(reader->ReadUInt32()); - cutscene->commands.push_back(reader->ReadUInt32()); - cutscene->commands.push_back(reader->ReadUInt32()); - cutscene->commands.push_back(reader->ReadUInt32()); - cutscene->commands.push_back(reader->ReadUInt32()); - cutscene->commands.push_back(reader->ReadUInt32()); - cutscene->commands.push_back(reader->ReadUInt32()); - cutscene->commands.push_back(reader->ReadUInt32()); - cutscene->commands.push_back(reader->ReadUInt32()); - } - break; - } - case CS_CMD_RUMBLE: { - uint32_t size = reader->ReadUInt32(); - cutscene->commands.push_back(size); - - for (uint32_t i = 0; i < size; i++) { - cutscene->commands.push_back(read_CMD_HH(reader)); - cutscene->commands.push_back(read_CMD_HBB(reader)); - cutscene->commands.push_back(read_CMD_BBBB(reader)); - } - break; - } - case 0xFFFFFFFF: { - cutscene->commands.push_back(reader->ReadUInt32()); - return; - } - } - } -} - +#endif } // namespace LUS diff --git a/mm/2s2h/resource/importer/CutsceneFactory.h b/mm/2s2h/resource/importer/CutsceneFactory.h index 729041ce3..2b0c91651 100644 --- a/mm/2s2h/resource/importer/CutsceneFactory.h +++ b/mm/2s2h/resource/importer/CutsceneFactory.h @@ -1,25 +1,12 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class Cutscene; -class CutsceneFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryCutsceneV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; -}; - -class CutsceneFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - - private: - void ParseFileBinaryOoT(std::shared_ptr reader,std::shared_ptr cutscene); - void ParseFileBinaryMM(std::shared_ptr reader, std::shared_ptr cutscene); + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/mm/2s2h/resource/importer/KeyFrameFactory.cpp b/mm/2s2h/resource/importer/KeyFrameFactory.cpp index 36166c91e..6804396a4 100644 --- a/mm/2s2h/resource/importer/KeyFrameFactory.cpp +++ b/mm/2s2h/resource/importer/KeyFrameFactory.cpp @@ -4,38 +4,18 @@ #include "spdlog/spdlog.h" #include "../ZAPDTR/ZAPD/ZCKeyFrame.h" -namespace LUS { - - - -std::shared_ptr KeyFrameSkelFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; +namespace SOH { +std::shared_ptr ResourceFactoryBinaryKeyFrameSkel::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; } - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Key Frame skel with version {}", resource->GetInitData()->ResourceVersion); - } + auto skel = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void KeyFrameSkelFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { - std::shared_ptr skel = std::static_pointer_cast(resource); - ZKeyframeSkelType skelType; - - ResourceVersionFactory::ParseFileBinary(reader, skel); skel->skelData.limbCount = reader->ReadUByte(); skel->skelData.dListCount = reader->ReadUByte(); - skelType = (ZKeyframeSkelType)reader->ReadUByte(); + ZKeyframeSkelType skelType = (ZKeyframeSkelType)reader->ReadUByte(); uint8_t numLimbs = reader->ReadUByte(); if (skelType == ZKeyframeSkelType::Normal) { @@ -69,39 +49,22 @@ void KeyFrameSkelFactoryV0::ParseFileBinary(std::shared_ptr reader limbs[i].flags = reader->ReadUByte(); limbs[i].callbackIndex = reader->ReadUByte(); } - skel->skelData.limbsFlex = limbs; + skel->skelData.limbsFlex = limbs; } + + return skel; } -std::shared_ptr KeyFrameAnimFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; +std::shared_ptr ResourceFactoryBinaryKeyFrameAnim::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; } - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Key Frame skel with version {}", resource->GetInitData()->ResourceVersion); - } + auto anim = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void KeyFrameAnimFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { - std::shared_ptr anim = std::static_pointer_cast(resource); - ZKeyframeSkelType skelType; - - ResourceVersionFactory::ParseFileBinary(reader, anim); - - skelType = (ZKeyframeSkelType)reader->ReadUByte(); - - uint32_t numBitFlags = reader->ReadUInt32(); + const ZKeyframeSkelType skelType = (ZKeyframeSkelType)reader->ReadUByte(); + const uint32_t numBitFlags = reader->ReadUInt32(); if (skelType == ZKeyframeSkelType::Normal) { anim->animData.bitFlags = new u8[numBitFlags]; @@ -142,6 +105,7 @@ void KeyFrameAnimFactoryV0::ParseFileBinary(std::shared_ptr reader anim->animData.unk_10[0] = reader->ReadUByte(); anim->animData.duration = reader->ReadUInt16(); -} -} // namespace LUS \ No newline at end of file + return anim; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/KeyFrameFactory.h b/mm/2s2h/resource/importer/KeyFrameFactory.h index 476635f2a..a76ad93b9 100644 --- a/mm/2s2h/resource/importer/KeyFrameFactory.h +++ b/mm/2s2h/resource/importer/KeyFrameFactory.h @@ -1,29 +1,17 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class KeyFrameSkelFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinaryKeyFrameSkel : public LUS::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class KeyFrameSkelFactoryV0 : public ResourceVersionFactory { +class ResourceFactoryBinaryKeyFrameAnim : public LUS::ResourceFactoryBinary { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; - -class KeyFrameAnimFactory : public ResourceFactory { - public: - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; -}; - -class KeyFrameAnimFactoryV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; \ No newline at end of file diff --git a/mm/2s2h/resource/importer/PathFactory.cpp b/mm/2s2h/resource/importer/PathFactory.cpp index 07e5b6e7b..26b58db23 100644 --- a/mm/2s2h/resource/importer/PathFactory.cpp +++ b/mm/2s2h/resource/importer/PathFactory.cpp @@ -2,82 +2,14 @@ #include "2s2h/resource/type/Path.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -PathFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Path with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::PathFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr path = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, path); - - path->numPaths = reader->ReadUInt32(); - path->paths.reserve(path->numPaths); - for (uint32_t k = 0; k < path->numPaths; k++) { - std::vector points; - uint32_t pointCount = reader->ReadUInt32(); - points.reserve(pointCount); - for (uint32_t i = 0; i < pointCount; i++) { - Vec3s point; - point.x = reader->ReadInt16(); - point.y = reader->ReadInt16(); - point.z = reader->ReadInt16(); - - points.push_back(point); - } - - PathData pathDataEntry; - pathDataEntry.count = pointCount; - - path->paths.push_back(points); - pathDataEntry.points = path->paths.back().data(); - - path->pathData.push_back(pathDataEntry); - } -} - -std::shared_ptr PathFactoryMM::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Path with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryPathMMV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::PathFactoryMMV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { - std::shared_ptr path = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, path); + auto path = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); path->numPaths = reader->ReadUInt32(); path->paths.reserve(path->numPaths); @@ -107,7 +39,7 @@ void LUS::PathFactoryMMV0::ParseFileBinary(std::shared_ptr reader, path->pathData.push_back(pathDataEntry); } + + return path; } - - -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/PathFactory.h b/mm/2s2h/resource/importer/PathFactory.h index 08f9e26cf..0f564dc92 100644 --- a/mm/2s2h/resource/importer/PathFactory.h +++ b/mm/2s2h/resource/importer/PathFactory.h @@ -1,31 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class PathFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryPathMMV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class PathFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; - -class PathFactoryMM : public ResourceFactory { - public: - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; -}; - -class PathFactoryMMV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; - -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/PlayerAnimationFactory.cpp b/mm/2s2h/resource/importer/PlayerAnimationFactory.cpp index 7e6aba360..b54ffeaeb 100644 --- a/mm/2s2h/resource/importer/PlayerAnimationFactory.cpp +++ b/mm/2s2h/resource/importer/PlayerAnimationFactory.cpp @@ -2,34 +2,15 @@ #include "2s2h/resource/type/PlayerAnimation.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -PlayerAnimationFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; +namespace SOH { +std::shared_ptr +ResourceFactoryBinaryPlayerAnimationV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; } - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr playerAnimation = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, playerAnimation); + auto playerAnimation = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); uint32_t numEntries = reader->ReadUInt32(); playerAnimation->limbRotData.reserve(numEntries); @@ -37,5 +18,7 @@ void LUS::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptrlimbRotData.push_back(reader->ReadInt16()); } + + return playerAnimation; } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/PlayerAnimationFactory.h b/mm/2s2h/resource/importer/PlayerAnimationFactory.h index b4981f7c6..8e1b6c36e 100644 --- a/mm/2s2h/resource/importer/PlayerAnimationFactory.h +++ b/mm/2s2h/resource/importer/PlayerAnimationFactory.h @@ -1,17 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class PlayerAnimationFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinaryPlayerAnimationV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; -}; - -class PlayerAnimationFactoryV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; }; // namespace LUS diff --git a/mm/2s2h/resource/importer/SceneFactory.cpp b/mm/2s2h/resource/importer/SceneFactory.cpp index 67320daa8..295e87e1a 100644 --- a/mm/2s2h/resource/importer/SceneFactory.cpp +++ b/mm/2s2h/resource/importer/SceneFactory.cpp @@ -1,4 +1,5 @@ #include "spdlog/spdlog.h" +#include "2s2h/resource/type/2shResourceType.h" #include "2s2h/resource/importer/SceneFactory.h" #include "2s2h/resource/type/Scene.h" #include "2s2h/resource/type/scenecommand/SceneCommand.h" @@ -32,77 +33,43 @@ #include "2s2h/resource/importer/scenecommand/SetMinimapChestsFactory.h" #include "2s2h/resource/importer/scenecommand/SetActorCutsceneListFactory.h" -namespace LUS { - -std::shared_ptr -SceneFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - if (SceneFactory::sceneCommandFactories.empty()) { - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightingSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetWind] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetExitList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetTimeSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSkyboxModifier] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetEchoSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSoundSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSkyboxSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetRoomBehavior] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCsCamera] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCameraSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetRoomList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCollisionHeader] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetEntranceList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSpecialObjects] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetObjectList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetStartPositionList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetActorList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetTransitionActorList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::EndMarker] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetAlternateHeaders] = std::make_shared(); - // TODO should we use a different custom scene command like cutscenes? - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetPathways] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCutscenes] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetMesh] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCutscenesMM] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetAnimatedMaterialList] = - std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetMinimapList] = - std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetMinimapChests] = - std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetActorCutsceneList] = - std::make_shared(); - } - - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Scene with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; +namespace SOH { +ResourceFactoryBinarySceneV0::ResourceFactoryBinarySceneV0() { + sceneCommandFactories[SceneCommandID::SetLightingSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetWind] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetExitList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetTimeSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSkyboxModifier] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetEchoSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSoundSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSkyboxSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetRoomBehavior] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCsCamera] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCameraSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetRoomList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCollisionHeader] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetEntranceList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSpecialObjects] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetObjectList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetStartPositionList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetActorList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetTransitionActorList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::EndMarker] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetAlternateHeaders] = std::make_shared(); + // TODO should we use a different custom scene command like cutscenes? + sceneCommandFactories[SceneCommandID::SetPathways] = std::make_shared(); + //sceneCommandFactories[SceneCommandID::SetCutscenes] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetLightList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetMesh] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCutscenesMM] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetAnimatedMaterialList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetMinimapList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetMinimapChests] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetActorCutsceneList] = std::make_shared(); } -void SceneFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr scene = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, scene); - - ParseSceneCommands(scene, reader); -} - -void SceneFactoryV0::ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader) { +void ResourceFactoryBinarySceneV0::ParseSceneCommands(std::shared_ptr scene, + std::shared_ptr reader) { uint32_t commandCount = reader->ReadUInt32(); scene->commands.reserve(commandCount); @@ -111,19 +78,20 @@ void SceneFactoryV0::ParseSceneCommands(std::shared_ptr scene, std::share } } -std::shared_ptr SceneFactoryV0::ParseSceneCommand(std::shared_ptr scene, - std::shared_ptr reader, uint32_t index) { +std::shared_ptr +ResourceFactoryBinarySceneV0::ParseSceneCommand(std::shared_ptr scene, std::shared_ptr reader, + uint32_t index) { SceneCommandID cmdID = (SceneCommandID)reader->ReadInt32(); - reader->Seek(-sizeof(int32_t), SeekOffsetType::Current); + reader->Seek(-sizeof(int32_t), LUS::SeekOffsetType::Current); std::shared_ptr result = nullptr; - std::shared_ptr commandFactory = SceneFactory::sceneCommandFactories[cmdID]; + auto commandFactory = ResourceFactoryBinarySceneV0::sceneCommandFactories[cmdID]; if (commandFactory != nullptr) { - auto initData = std::make_shared(); + auto initData = std::make_shared(); initData->Id = scene->GetInitData()->Id; - initData->Type = ResourceType::SOH_SceneCommand; + initData->Type = static_cast(ResourceType::SOH_SceneCommand); initData->Path = scene->GetInitData()->Path + "/SceneCommand" + std::to_string(index); initData->ResourceVersion = scene->GetInitData()->ResourceVersion; result = std::static_pointer_cast(commandFactory->ReadResource(initData, reader)); @@ -131,10 +99,23 @@ std::shared_ptr SceneFactoryV0::ParseSceneCommand(std::shared_ptr } if (result == nullptr) { - SPDLOG_ERROR("Failed to load scene command of type {} in scene {}", (uint32_t)cmdID, scene->GetInitData()->Path); + SPDLOG_ERROR("Failed to load scene command of type {} in scene {}", (uint32_t)cmdID, + scene->GetInitData()->Path); } return result; } -} // namespace LUS +std::shared_ptr ResourceFactoryBinarySceneV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto scene = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); + + ParseSceneCommands(scene, reader); + + return scene; +}; +} // namespace SOH diff --git a/mm/2s2h/resource/importer/SceneFactory.h b/mm/2s2h/resource/importer/SceneFactory.h index 40887983d..988a23de9 100644 --- a/mm/2s2h/resource/importer/SceneFactory.h +++ b/mm/2s2h/resource/importer/SceneFactory.h @@ -4,26 +4,25 @@ #include "2s2h/resource/type/scenecommand/SceneCommand.h" #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class SceneFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinarySceneV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + ResourceFactoryBinarySceneV0(); + + std::shared_ptr ReadResource(std::shared_ptr file) override; + void ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader); // Doing something very similar to what we do on the ResourceLoader. // Eventually, scene commands should be moved up to the ResourceLoader as well. // They can not right now because the exporter does not give them a proper resource type enum value, // and the exporter does not export the commands with a proper OTR header. - static inline std::unordered_map> sceneCommandFactories; -}; + static inline std::unordered_map> + sceneCommandFactories; -class SceneFactoryV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader); -protected: - std::shared_ptr ParseSceneCommand(std::shared_ptr scene, std::shared_ptr reader, uint32_t index); + protected: + std::shared_ptr ParseSceneCommand(std::shared_ptr scene, + std::shared_ptr reader, uint32_t index); }; -}; // namespace LUS +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/importer/SkeletonFactory.cpp b/mm/2s2h/resource/importer/SkeletonFactory.cpp index aa4c814bd..de309e1cb 100644 --- a/mm/2s2h/resource/importer/SkeletonFactory.cpp +++ b/mm/2s2h/resource/importer/SkeletonFactory.cpp @@ -3,54 +3,14 @@ #include #include -namespace LUS { -std::shared_ptr -SkeletonFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -std::shared_ptr -SkeletonFactory::ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileXML(reader, resource); - - return resource; -} - -void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr skeleton = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, skeleton); + auto skeleton = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); skeleton->type = (SkeletonType)reader->ReadInt8(); skeleton->limbType = (LimbType)reader->ReadInt8(); @@ -66,17 +26,17 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr reader, skeleton->limbTable.push_back(limbPath); } - if (skeleton->type == LUS::SkeletonType::Curve) { + if (skeleton->type == SkeletonType::Curve) { skeleton->skeletonData.skelCurveLimbList.limbCount = skeleton->limbCount; skeleton->curveLimbArray.reserve(skeleton->skeletonData.skelCurveLimbList.limbCount); - } else if (skeleton->type == LUS::SkeletonType::Flex) { + } else if (skeleton->type == SkeletonType::Flex) { skeleton->skeletonData.flexSkeletonHeader.dListCount = skeleton->dListCount; } - if (skeleton->type == LUS::SkeletonType::Normal) { + if (skeleton->type == SkeletonType::Normal) { skeleton->skeletonData.skeletonHeader.limbCount = skeleton->limbCount; skeleton->standardLimbArray.reserve(skeleton->skeletonData.skeletonHeader.limbCount); - } else if (skeleton->type == LUS::SkeletonType::Flex) { + } else if (skeleton->type == SkeletonType::Flex) { skeleton->skeletonData.flexSkeletonHeader.sh.limbCount = skeleton->limbCount; skeleton->standardLimbArray.reserve(skeleton->skeletonData.flexSkeletonHeader.sh.limbCount); } @@ -87,53 +47,63 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr reader, skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr); } - if (skeleton->type == LUS::SkeletonType::Normal) { + if (skeleton->type == SkeletonType::Normal) { skeleton->skeletonData.skeletonHeader.segment = (void**)skeleton->skeletonHeaderSegments.data(); - } else if (skeleton->type == LUS::SkeletonType::Flex) { + } else if (skeleton->type == SkeletonType::Flex) { skeleton->skeletonData.flexSkeletonHeader.sh.segment = (void**)skeleton->skeletonHeaderSegments.data(); - } else if (skeleton->type == LUS::SkeletonType::Curve) { + } else if (skeleton->type == SkeletonType::Curve) { skeleton->skeletonData.skelCurveLimbList.limbs = (SkelCurveLimb**)skeleton->skeletonHeaderSegments.data(); } else { SPDLOG_ERROR("unknown skeleton type {}", (uint32_t)skeleton->type); } skeleton->skeletonData.skeletonHeader.skeletonType = (uint8_t)skeleton->type; + + return skeleton; } -void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) -{ - std::shared_ptr skel = std::static_pointer_cast(resource); - std::string skeletonType = reader->Attribute("Type"); - // std::string skeletonLimbType = reader->Attribute("LimbType"); - int numLimbs = reader->IntAttribute("LimbCount"); - int numDLs = reader->IntAttribute("DisplayListCount"); - - if (skeletonType == "Flex") { - skel->type = SkeletonType::Flex; - } else if (skeletonType == "Curve") { - skel->type = SkeletonType::Curve; - } else if (skeletonType == "Normal") { - skel->type = SkeletonType::Normal; +std::shared_ptr ResourceFactoryXMLSkeletonV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; } - skel->type = SkeletonType::Flex; - skel->limbType = LimbType::LOD; - - // if (skeletonLimbType == "Standard") - // skel->limbType = LimbType::Standard; - // else if (skeletonLimbType == "LOD") - // skel->limbType = LimbType::LOD; - // else if (skeletonLimbType == "Curve") - // skel->limbType = LimbType::Curve; - // else if (skeletonLimbType == "Skin") - // skel->limbType = LimbType::Skin; - // else if (skeletonLimbType == "Legacy") - // Sskel->limbType = LimbType::Legacy; - + auto skel = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader)->FirstChildElement(); auto child = reader->FirstChildElement(); - skel->limbCount = numLimbs; - skel->dListCount = numDLs; + skel->type = SkeletonType::Flex; // Default to Flex for legacy reasons + if (reader->FindAttribute("Type")) { + std::string skeletonType = reader->Attribute("Type"); + + if (skeletonType == "Flex") { + skel->type = SkeletonType::Flex; + } else if (skeletonType == "Curve") { + skel->type = SkeletonType::Curve; + } else if (skeletonType == "Normal") { + skel->type = SkeletonType::Normal; + } + } + + skel->limbType = LimbType::LOD; // Default to LOD for legacy reasons + if (reader->FindAttribute("LimbType")) { + std::string skeletonLimbType = reader->Attribute("LimbType"); + + if (skeletonLimbType == "Standard") { + skel->limbType = LimbType::Standard; + } else if (skeletonLimbType == "LOD") { + skel->limbType = LimbType::LOD; + } else if (skeletonLimbType == "Curve") { + skel->limbType = LimbType::Curve; + } else if (skeletonLimbType == "Skin") { + skel->limbType = LimbType::Skin; + } else if (skeletonLimbType == "Legacy") { + skel->limbType = LimbType::Legacy; + } + } + + + skel->limbCount = reader->IntAttribute("LimbCount"); + skel->dListCount = reader->IntAttribute("DisplayListCount"); while (child != nullptr) { std::string childName = child->Name(); @@ -153,6 +123,7 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p skel->skeletonData.flexSkeletonHeader.sh.segment = (void**)skel->skeletonHeaderSegments.data(); skel->skeletonData.flexSkeletonHeader.dListCount = skel->dListCount; skel->skeletonData.skeletonHeader.skeletonType = (uint8_t)skel->type; -} -} // namespace LUS + return skel; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/SkeletonFactory.h b/mm/2s2h/resource/importer/SkeletonFactory.h index d64449393..5de02175f 100644 --- a/mm/2s2h/resource/importer/SkeletonFactory.h +++ b/mm/2s2h/resource/importer/SkeletonFactory.h @@ -1,23 +1,17 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" +#include "ResourceFactoryXML.h" -namespace LUS { -class SkeletonFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinarySkeletonV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; - std::shared_ptr - ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class SkeletonFactoryV0 : public ResourceVersionFactory -{ +class ResourceFactoryXMLSkeletonV0 : public LUS::ResourceFactoryXML { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -}; // namespace LUS - +} // namespace SOH diff --git a/mm/2s2h/resource/importer/SkeletonLimbFactory.cpp b/mm/2s2h/resource/importer/SkeletonLimbFactory.cpp index ad2fec085..5879465af 100644 --- a/mm/2s2h/resource/importer/SkeletonLimbFactory.cpp +++ b/mm/2s2h/resource/importer/SkeletonLimbFactory.cpp @@ -3,54 +3,14 @@ #include "spdlog/spdlog.h" #include "libultraship/libultraship.h" -namespace LUS { -std::shared_ptr -SkeletonLimbFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -std::shared_ptr -SkeletonLimbFactory::ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinarySkeletonLimbV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileXML(reader, resource); - - return resource; -} - -void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr skeletonLimb = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb); + auto skeletonLimb = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); skeletonLimb->limbType = (LimbType)reader->ReadInt8(); skeletonLimb->skinSegmentType = (ZLimbSkinType)reader->ReadInt8(); @@ -124,7 +84,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r skeletonLimb->childIndex = reader->ReadUByte(); skeletonLimb->siblingIndex = reader->ReadUByte(); - if (skeletonLimb->limbType == LUS::LimbType::LOD) { + if (skeletonLimb->limbType == LimbType::LOD) { skeletonLimb->limbData.lodLimb.jointPos.x = skeletonLimb->transX; skeletonLimb->limbData.lodLimb.jointPos.y = skeletonLimb->transY; skeletonLimb->limbData.lodLimb.jointPos.z = skeletonLimb->transZ; @@ -132,19 +92,19 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r skeletonLimb->limbData.lodLimb.sibling = skeletonLimb->siblingIndex; if (skeletonLimb->dListPtr != "") { - auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str()); - skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr); + skeletonLimb->dListPtr = "__OTR__" + skeletonLimb->dListPtr; + skeletonLimb->limbData.lodLimb.dLists[0] = (Gfx*)skeletonLimb->dListPtr.c_str(); } 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->GetRawPointer() : nullptr); + skeletonLimb->dList2Ptr = "__OTR__" + skeletonLimb->dList2Ptr; + skeletonLimb->limbData.lodLimb.dLists[1] = (Gfx*)skeletonLimb->dList2Ptr.c_str(); } else { skeletonLimb->limbData.lodLimb.dLists[1] = nullptr; } - } else if (skeletonLimb->limbType == LUS::LimbType::Standard) { + } else if (skeletonLimb->limbType == LimbType::Standard) { skeletonLimb->limbData.standardLimb.jointPos.x = skeletonLimb->transX; skeletonLimb->limbData.standardLimb.jointPos.y = skeletonLimb->transY; skeletonLimb->limbData.standardLimb.jointPos.z = skeletonLimb->transZ; @@ -153,50 +113,59 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r skeletonLimb->limbData.standardLimb.dList = nullptr; if (!skeletonLimb->dListPtr.empty()) { - const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str()); - skeletonLimb->limbData.standardLimb.dList = (Gfx*)(dList ? dList->GetRawPointer() : nullptr); + skeletonLimb->dListPtr = "__OTR__" + skeletonLimb->dListPtr; + skeletonLimb->limbData.standardLimb.dList = (Gfx*)skeletonLimb->dListPtr.c_str(); } - } else if (skeletonLimb->limbType == LUS::LimbType::Curve) { + } else if (skeletonLimb->limbType == LimbType::Curve) { skeletonLimb->limbData.skelCurveLimb.firstChildIdx = skeletonLimb->childIndex; skeletonLimb->limbData.skelCurveLimb.nextLimbIdx = skeletonLimb->siblingIndex; skeletonLimb->limbData.skelCurveLimb.dList[0] = nullptr; skeletonLimb->limbData.skelCurveLimb.dList[1] = nullptr; if (!skeletonLimb->dListPtr.empty()) { - const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dListPtr.c_str()); - skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr); + skeletonLimb->dListPtr = "__OTR__" + skeletonLimb->dListPtr; + skeletonLimb->limbData.skelCurveLimb.dList[0] = (Gfx*)skeletonLimb->dListPtr.c_str(); } if (!skeletonLimb->dList2Ptr.empty()) { - const auto dList = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->dList2Ptr.c_str()); - skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)(dList ? dList->GetRawPointer() : nullptr); + skeletonLimb->dList2Ptr = "__OTR__" + skeletonLimb->dList2Ptr; + skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)skeletonLimb->dList2Ptr.c_str(); } - } else if (skeletonLimb->limbType == LUS::LimbType::Skin) { + } else if (skeletonLimb->limbType == LimbType::Skin) { skeletonLimb->limbData.skinLimb.jointPos.x = skeletonLimb->transX; skeletonLimb->limbData.skinLimb.jointPos.y = skeletonLimb->transY; skeletonLimb->limbData.skinLimb.jointPos.z = skeletonLimb->transZ; skeletonLimb->limbData.skinLimb.child = skeletonLimb->childIndex; skeletonLimb->limbData.skinLimb.sibling = skeletonLimb->siblingIndex; - if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) { + if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_DList) { skeletonLimb->limbData.skinLimb.segmentType = static_cast(skeletonLimb->skinSegmentType); - } else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) { + } else if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_4) { skeletonLimb->limbData.skinLimb.segmentType = 4; - } else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_5) { + } else if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_5) { skeletonLimb->limbData.skinLimb.segmentType = 5; } else { skeletonLimb->limbData.skinLimb.segmentType = 0; } - if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) { - auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(skeletonLimb->skinDList.c_str()); - skeletonLimb->limbData.skinLimb.segment = res ? res->GetRawPointer() : nullptr; - } else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) { + if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_DList) { + if (skeletonLimb->skinDList != "") { + skeletonLimb->skinDList = "__OTR__" + skeletonLimb->skinDList; + skeletonLimb->limbData.skinLimb.segment = (Gfx*)skeletonLimb->skinDList.c_str(); + } else { + skeletonLimb->limbData.skinLimb.segment = nullptr; + } + } else if (skeletonLimb->skinSegmentType == 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->GetRawPointer() : nullptr); + + if (skeletonLimb->skinDList2 != "") { + skeletonLimb->skinDList2 = "__OTR__" + skeletonLimb->skinDList2; + skeletonLimb->skinAnimLimbData.dlist = (Gfx*)skeletonLimb->skinDList2.c_str(); + } else { + skeletonLimb->skinAnimLimbData.dlist = nullptr; + } for (size_t i = 0; i < skeletonLimb->skinLimbModifArray.size(); i++) { skeletonLimb->skinAnimLimbData.limbModifications[i].vtxCount = skeletonLimb->skinLimbModifVertexArrays[i].size(); @@ -211,10 +180,17 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r skeletonLimb->limbData.skinLimb.segment = &skeletonLimb->skinAnimLimbData; } } + + return skeletonLimb; } -void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) -{ - std::shared_ptr skelLimb = std::static_pointer_cast(resource); + +std::shared_ptr ResourceFactoryXMLSkeletonLimbV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto skelLimb = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader)->FirstChildElement(); std::string limbType = reader->Attribute("Type"); @@ -254,8 +230,8 @@ void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shar limbData.lodLimb.jointPos.z = skelLimb->transZ; if (skelLimb->dListPtr != "") { - auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess((const char*)skelLimb->dListPtr.c_str()); - limbData.lodLimb.dLists[0] = (Gfx*)(res ? res->GetRawPointer() : nullptr); + skelLimb->dListPtr = "__OTR__" + skelLimb->dListPtr; + limbData.lodLimb.dLists[0] = (Gfx*)skelLimb->dListPtr.c_str(); } else { limbData.lodLimb.dLists[0] = nullptr; } @@ -266,6 +242,7 @@ void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shar limbData.lodLimb.sibling = skelLimb->siblingIndex; // skelLimb->dList2Ptr = reader->Attribute("DisplayList2"); -} -} // namespace LUS + return skelLimb; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/SkeletonLimbFactory.h b/mm/2s2h/resource/importer/SkeletonLimbFactory.h index 8480a0126..125dde2b8 100644 --- a/mm/2s2h/resource/importer/SkeletonLimbFactory.h +++ b/mm/2s2h/resource/importer/SkeletonLimbFactory.h @@ -1,23 +1,17 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" +#include "ResourceFactoryXML.h" -namespace LUS { -class SkeletonLimbFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinarySkeletonLimbV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; - std::shared_ptr - ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class SkeletonLimbFactoryV0 : public ResourceVersionFactory -{ +class ResourceFactoryXMLSkeletonLimbV0 : public LUS::ResourceFactoryXML { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -}; // namespace LUS - +} // namespace SOH diff --git a/mm/2s2h/resource/importer/TextFactory.cpp b/mm/2s2h/resource/importer/TextFactory.cpp deleted file mode 100644 index 7d7ffb4f3..000000000 --- a/mm/2s2h/resource/importer/TextFactory.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "2s2h/resource/importer/TextFactory.h" -#include "2s2h/resource/type/Text.h" -#include "spdlog/spdlog.h" - -namespace LUS { -std::shared_ptr -TextFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - default: - // VERSION NOT SUPPORTED - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -std::shared_ptr -TextFactory::ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileXML(reader, resource); - - return resource; -} - -void LUS::TextFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr text = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, text); - - uint32_t msgCount = reader->ReadUInt32(); - text->messages.reserve(msgCount); - - for (uint32_t i = 0; i < msgCount; i++) { - MessageEntry entry; - entry.id = reader->ReadUInt16(); - entry.textboxType = reader->ReadUByte(); - entry.textboxYPos = reader->ReadUByte(); - entry.msg = reader->ReadString(); - - text->messages.push_back(entry); - } -} -void TextFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) { - std::shared_ptr txt = std::static_pointer_cast(resource); - - auto child = reader->FirstChildElement(); - - while (child != nullptr) { - std::string childName = child->Name(); - - if (childName == "TextEntry") { - MessageEntry entry; - entry.id = child->IntAttribute("ID"); - entry.textboxType = child->IntAttribute("TextboxType"); - entry.textboxYPos = child->IntAttribute("TextboxYPos"); - entry.msg = child->Attribute("Message"); - entry.msg += "\x2"; - - txt->messages.push_back(entry); - int bp = 0; - } - - child = child->NextSiblingElement(); - } -} - -} // namespace LUS diff --git a/mm/2s2h/resource/importer/TextFactory.h b/mm/2s2h/resource/importer/TextFactory.h deleted file mode 100644 index 7a6ae2841..000000000 --- a/mm/2s2h/resource/importer/TextFactory.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "Resource.h" -#include "ResourceFactory.h" - -namespace LUS { -class TextFactory : public ResourceFactory -{ - public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; - std::shared_ptr - ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; -}; - -class TextFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; -}; -}; // namespace LUS - diff --git a/mm/2s2h/resource/importer/TextMMFactory.cpp b/mm/2s2h/resource/importer/TextMMFactory.cpp index 3c2892001..ce6a1c923 100644 --- a/mm/2s2h/resource/importer/TextMMFactory.cpp +++ b/mm/2s2h/resource/importer/TextMMFactory.cpp @@ -2,57 +2,16 @@ #include "2s2h/resource/type/TextMM.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -TextMMFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - default: - // VERSION NOT SUPPORTED - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -std::shared_ptr TextMMFactory::ReadResourceXML(std::shared_ptr initData, - tinyxml2::XMLElement* reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryTextMMV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileXML(reader, resource); + auto text = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); - return resource; -} - -void LUS::TextMMFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { - std::shared_ptr text = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, text); - - uint32_t msgCount = reader->ReadUInt32(); + const uint32_t msgCount = reader->ReadUInt32(); text->messages.reserve(msgCount); for (uint32_t i = 0; i < msgCount; i++) { @@ -68,9 +27,17 @@ void LUS::TextMMFactoryV0::ParseFileBinary(std::shared_ptr reader, text->messages.push_back(entry); } + + return text; } -void TextMMFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) { - std::shared_ptr txt = std::static_pointer_cast(resource); + +std::shared_ptr ResourceFactoryXMLTextMMV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto text = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader)->FirstChildElement(); auto child = reader->FirstChildElement(); @@ -82,19 +49,19 @@ void TextMMFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr entry.id = child->IntAttribute("ID"); entry.textboxType = child->IntAttribute("TextboxType"); entry.textboxYPos = child->IntAttribute("TextboxYPos"); - - // BENTODO: MM Unique Fields + // BENTODO: MM Unique Fields entry.msg = child->Attribute("Message"); entry.msg += "\x2"; - txt->messages.push_back(entry); + text->messages.push_back(entry); int bp = 0; } child = child->NextSiblingElement(); } -} + return text; +} } // namespace LUS diff --git a/mm/2s2h/resource/importer/TextMMFactory.h b/mm/2s2h/resource/importer/TextMMFactory.h index 0322a3762..97eedfcf2 100644 --- a/mm/2s2h/resource/importer/TextMMFactory.h +++ b/mm/2s2h/resource/importer/TextMMFactory.h @@ -1,10 +1,22 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" +#include "ResourceFactoryXML.h" -namespace LUS { -class TextMMFactory : public ResourceFactory +namespace SOH { +class ResourceFactoryBinaryTextMMV0 : public LUS::ResourceFactoryBinary { + public: + std::shared_ptr ReadResource(std::shared_ptr file) override; +}; + +class ResourceFactoryXMLTextMMV0 : public LUS::ResourceFactoryXML { + public: + std::shared_ptr ReadResource(std::shared_ptr file) override; +}; + +#if 0 +class TextMMFactory : public LUS::ResourceFactoryBinary { public: std::shared_ptr @@ -12,12 +24,6 @@ class TextMMFactory : public ResourceFactory std::shared_ptr ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; }; - -class TextMMFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; -}; +#endif }; // namespace LUS diff --git a/mm/2s2h/resource/importer/TextureAnimationFactory.cpp b/mm/2s2h/resource/importer/TextureAnimationFactory.cpp index 80470166c..fe0807f7b 100644 --- a/mm/2s2h/resource/importer/TextureAnimationFactory.cpp +++ b/mm/2s2h/resource/importer/TextureAnimationFactory.cpp @@ -3,36 +3,18 @@ #include #include "spdlog/spdlog.h" -namespace LUS { +namespace SOH { -std::shared_ptr TextureAnimationFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Texture Animation with version {}", resource->GetInitData()->ResourceVersion); +std::shared_ptr ResourceFactoryBinaryTextureAnimationV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); + auto tAnim = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); - return resource; -} + const size_t numEntries = reader->ReadUInt32(); -void LUS::TextureAnimationFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr tAnim = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, tAnim); - - size_t numEntries = reader->ReadUInt32(); - for (size_t i = 0; i < numEntries; i++) { AnimatedMaterial anim; anim.segment = reader->ReadInt8(); @@ -67,7 +49,7 @@ void LUS::TextureAnimationFactoryV0::ParseFileBinary(std::shared_ptrkeyFrameLength = reader->ReadUInt16(); e->keyFrameCount = reader->ReadUInt16(); - + size_t frames = reader->ReadUInt32(); e->keyFrames = new uint16_t[frames]; @@ -76,7 +58,7 @@ void LUS::TextureAnimationFactoryV0::ParseFileBinary(std::shared_ptrReadUInt32(); e->primColors = new F3DPrimColor[primColorSize]; - + for (size_t i = 0; i < primColorSize; i++) { e->primColors[i].r = reader->ReadUByte(); e->primColors[i].g = reader->ReadUByte(); @@ -123,6 +105,7 @@ void LUS::TextureAnimationFactoryV0::ParseFileBinary(std::shared_ptranims.emplace_back(anim); } -} -} // namespace LUS \ No newline at end of file + return tAnim; +} +} // namespace LUS diff --git a/mm/2s2h/resource/importer/TextureAnimationFactory.h b/mm/2s2h/resource/importer/TextureAnimationFactory.h index 1bc52e246..dd798f1b4 100644 --- a/mm/2s2h/resource/importer/TextureAnimationFactory.h +++ b/mm/2s2h/resource/importer/TextureAnimationFactory.h @@ -1,18 +1,13 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class TextureAnimationFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinaryTextureAnimationV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class TextureAnimationFactoryV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; }; // namespace LUS \ No newline at end of file diff --git a/mm/2s2h/resource/importer/scenecommand/EndMarkerFactory.cpp b/mm/2s2h/resource/importer/scenecommand/EndMarkerFactory.cpp index 61dba4ca3..1246a2273 100644 --- a/mm/2s2h/resource/importer/scenecommand/EndMarkerFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/EndMarkerFactory.cpp @@ -2,37 +2,13 @@ #include "2s2h/resource/type/scenecommand/EndMarker.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -EndMarkerFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load EndMarker with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr endMarker = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, endMarker); +namespace SOH { +std::shared_ptr +EndMarkerFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto endMarker = std::make_shared(initData); ReadCommandId(endMarker, reader); - - // This has no data. -} -} // namespace LUS + return endMarker; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/EndMarkerFactory.h b/mm/2s2h/resource/importer/scenecommand/EndMarkerFactory.h index a2580c077..3b694b83b 100644 --- a/mm/2s2h/resource/importer/scenecommand/EndMarkerFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/EndMarkerFactory.h @@ -2,15 +2,9 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class EndMarkerFactory : public SceneCommandFactory { +namespace SOH { +class EndMarkerFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class EndMarkerFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SceneCommandFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SceneCommandFactory.cpp index a2ed3c829..d18227883 100644 --- a/mm/2s2h/resource/importer/scenecommand/SceneCommandFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SceneCommandFactory.cpp @@ -2,8 +2,9 @@ #include "2s2h/resource/type/scenecommand/SceneCommand.h" #include "spdlog/spdlog.h" -namespace LUS { -void SceneCommandVersionFactory::ReadCommandId(std::shared_ptr command, std::shared_ptr reader) { +namespace SOH { +void SceneCommandFactoryBinaryV0::ReadCommandId(std::shared_ptr command, + std::shared_ptr reader) { command->cmdId = (SceneCommandID)reader->ReadInt32(); } } diff --git a/mm/2s2h/resource/importer/scenecommand/SceneCommandFactory.h b/mm/2s2h/resource/importer/scenecommand/SceneCommandFactory.h index b1449fad4..c686a148c 100644 --- a/mm/2s2h/resource/importer/scenecommand/SceneCommandFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SceneCommandFactory.h @@ -5,11 +5,13 @@ #include "ResourceFactory.h" #include "2s2h/resource/type/scenecommand/SceneCommand.h" -namespace LUS { -class SceneCommandFactory : public ResourceFactory {}; +namespace SOH { +class SceneCommandFactoryBinaryV0 { + public: + virtual std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) = 0; -class SceneCommandVersionFactory : public ResourceVersionFactory { -protected: - void ReadCommandId(std::shared_ptr command, std::shared_ptr reader); + protected: + void ReadCommandId(std::shared_ptr command, std::shared_ptr reader); }; -}; // namespace LUS +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/importer/scenecommand/SetActorCutsceneListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetActorCutsceneListFactory.cpp index 4ad852fb1..0426d51f3 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetActorCutsceneListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetActorCutsceneListFactory.cpp @@ -2,40 +2,16 @@ #include "2s2h/resource/type/scenecommand/SetActorCutsceneList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetActorCutsceneListFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetActorList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - - -void SetActorCutsceneListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setActorCsList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setActorCsList); - +namespace SOH { +std::shared_ptr SetActorCutsceneListFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setActorCsList = std::make_shared(initData); ReadCommandId(setActorCsList, reader); - setActorCsList->numEntries = reader->ReadUInt32(); - setActorCsList->entries.reserve(setActorCsList->numEntries); + uint32_t numEntries = reader->ReadUInt32(); + setActorCsList->entries.reserve(numEntries); - for (uint32_t i = 0; i < setActorCsList->numEntries; i++) { + for (uint32_t i = 0; i < numEntries; i++) { CutsceneEntry e; e.priority = reader->ReadInt16(); e.length = reader->ReadInt16(); @@ -49,7 +25,6 @@ void SetActorCutsceneListFactoryV0::ParseFileBinary(std::shared_ptrReadUByte(); setActorCsList->entries.emplace_back(e); } - + return setActorCsList; } - } // namespace LUS \ No newline at end of file diff --git a/mm/2s2h/resource/importer/scenecommand/SetActorCutsceneListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetActorCutsceneListFactory.h index 23314c129..9eb47db3f 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetActorCutsceneListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetActorCutsceneListFactory.h @@ -2,16 +2,9 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetActorCutsceneListFactory : public SceneCommandFactory { - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; +namespace SOH { +class SetActorCutsceneListFactory : public SceneCommandFactoryBinaryV0 { + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; }; - -class SetActorCutsceneListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - -}; - } diff --git a/mm/2s2h/resource/importer/scenecommand/SetActorListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetActorListFactory.cpp index 32aa3db5f..3b140cc8d 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetActorListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetActorListFactory.cpp @@ -2,52 +2,30 @@ #include "2s2h/resource/type/scenecommand/SetActorList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetActorListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetActorList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setActorList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setActorList); +namespace SOH { +std::shared_ptr +SetActorListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setActorList = std::make_shared(initData); ReadCommandId(setActorList, reader); setActorList->numActors = reader->ReadUInt32(); setActorList->actorList.reserve(setActorList->numActors); for (uint32_t i = 0; i < setActorList->numActors; i++) { - ActorEntry entry; + ActorEntry entry; - entry.id = reader->ReadUInt16(); - entry.pos.x = reader->ReadInt16(); - entry.pos.y = reader->ReadInt16(); - entry.pos.z = reader->ReadInt16(); - entry.rot.x = reader->ReadInt16(); - entry.rot.y = reader->ReadInt16(); - entry.rot.z = reader->ReadInt16(); - entry.params = reader->ReadUInt16(); + entry.id = reader->ReadUInt16(); + entry.pos.x = reader->ReadInt16(); + entry.pos.y = reader->ReadInt16(); + entry.pos.z = reader->ReadInt16(); + entry.rot.x = reader->ReadInt16(); + entry.rot.y = reader->ReadInt16(); + entry.rot.z = reader->ReadInt16(); + entry.params = reader->ReadUInt16(); setActorList->actorList.push_back(entry); } -} -} // namespace LUS + return setActorList; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetActorListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetActorListFactory.h index 5958ac576..4c00cca2a 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetActorListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetActorListFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetActorListFactory : public SceneCommandFactory { +namespace SOH { +class SetActorListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetActorListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp index d68d65c34..542a343e4 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp @@ -1,49 +1,25 @@ #include "2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.h" #include "2s2h/resource/type/scenecommand/SetAlternateHeaders.h" -#include "spdlog/spdlog.h" #include "libultraship/libultraship.h" -namespace LUS { -std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setAlternateHeaders = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setAlternateHeaders); +namespace SOH { +std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setAlternateHeaders = std::make_shared(initData); ReadCommandId(setAlternateHeaders, reader); setAlternateHeaders->numHeaders = reader->ReadUInt32(); setAlternateHeaders->headers.reserve(setAlternateHeaders->numHeaders); for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) { - auto headerName = reader->ReadString(); - if (!headerName.empty()) { - setAlternateHeaders->headers.push_back(std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str()))); - } else { - setAlternateHeaders->headers.push_back(nullptr); - } + auto headerName = reader->ReadString(); + if (!headerName.empty()) { + setAlternateHeaders->headers.push_back(std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str()))); + } else { + setAlternateHeaders->headers.push_back(nullptr); + } } -} -} // namespace LUS + return setAlternateHeaders; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.h b/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.h index efa96f68f..9cfbb0220 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetAlternateHeadersFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetAlternateHeadersFactory : public SceneCommandFactory { +namespace SOH { +class SetAlternateHeadersFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetAlternateHeadersFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp index e6e9865ec..f5fcefceb 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.cpp @@ -1,41 +1,23 @@ #include "2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.h" #include "2s2h/resource/type/scenecommand/SetAnimatedMaterialList.h" #include "2s2h/resource/type/TextureAnimation.h" -#include "spdlog/spdlog.h" #include -namespace LUS { - -std::shared_ptr LUS::SetAnimatedMaterialListFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetAnimatedMaterialList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetAnimatedMaterialListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setAnimatedMat = - std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setAnimatedMat); +namespace SOH { +std::shared_ptr SetAnimatedMaterialListFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setAnimatedMat = std::make_shared(initData); + ReadCommandId(setAnimatedMat, reader); - AnimatedMaterialData* res = (AnimatedMaterialData*)ResourceGetDataByName(reader->ReadString().c_str()); - setAnimatedMat->mat = res; -} + std::string str = reader->ReadString(); + const auto data = std::static_pointer_cast( + LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(str.c_str())); + + AnimatedMaterial* res = data->GetPointer(); + setAnimatedMat->mat = res; + + return setAnimatedMat; +} } // namespace LUS \ No newline at end of file diff --git a/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.h index 22e3fff69..2b3e50729 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetAnimatedMaterialListFactory.h @@ -2,16 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetAnimatedMaterialListFactory : public SceneCommandFactory { +namespace SOH { +class SetAnimatedMaterialListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; }; - -class SetAnimatedMaterialListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; - } diff --git a/mm/2s2h/resource/importer/scenecommand/SetCameraSettingsFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetCameraSettingsFactory.cpp index caa46cefd..4f919c96e 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetCameraSettingsFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetCameraSettingsFactory.cpp @@ -2,38 +2,13 @@ #include "2s2h/resource/type/scenecommand/SetCameraSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetCameraSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setCameraSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setCameraSettings); +namespace SOH { +std::shared_ptr SetCameraSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setCameraSettings = std::make_shared(initData); ReadCommandId(setCameraSettings, reader); - // BENTODO in MM this scene command is only used as a signal to have the scene system mark an area as visted. We should make a new command factory for this but this is fine for now. - //setCameraSettings->settings.cameraMovement = reader->ReadInt8(); - //setCameraSettings->settings.worldMapArea = reader->ReadInt32(); -} -} // namespace LUS + return setCameraSettings; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetCameraSettingsFactory.h b/mm/2s2h/resource/importer/scenecommand/SetCameraSettingsFactory.h index e17150807..5848d9f89 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetCameraSettingsFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetCameraSettingsFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetCameraSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetCameraSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; -}; - -class SetCameraSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; }; // namespace LUS diff --git a/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp index 4badbb055..1ce7874a9 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp @@ -3,37 +3,16 @@ #include "libultraship/libultraship.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetCollisionHeaderFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setCollisionHeader = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader); +namespace SOH { +std::shared_ptr SetCollisionHeaderFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setCollisionHeader = std::make_shared(initData); ReadCommandId(setCollisionHeader, reader); setCollisionHeader->fileName = reader->ReadString(); setCollisionHeader->collisionHeader = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCollisionHeader->fileName.c_str())); -} -} // namespace LUS + return setCollisionHeader; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.h b/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.h index 76655015d..1987ae788 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetCollisionHeaderFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetCollisionHeaderFactory : public SceneCommandFactory { +namespace SOH { +class SetCollisionHeaderFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetCollisionHeaderFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetCsCameraFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetCsCameraFactory.cpp index 445f64cb6..51bc3d0d9 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetCsCameraFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetCsCameraFactory.cpp @@ -2,36 +2,16 @@ #include "2s2h/resource/type/scenecommand/SetCsCamera.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetCsCameraFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetCsCamera with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setCsCamera = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setCsCamera); - +namespace SOH { +std::shared_ptr +SetCsCameraFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setCsCamera = std::make_shared(initData); + ReadCommandId(setCsCamera, reader); - - size_t camSize = reader->ReadUInt32(); + + size_t camSize = reader->ReadUInt32(); + + setCsCamera->csCamera.reserve(camSize); for (size_t i = 0; i < camSize; i++) { ActorCsCamInfoData data; @@ -49,7 +29,7 @@ void LUS::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr re } setCsCamera->csCamera.emplace_back(data); } - -} + return setCsCamera; +} } // namespace LUS diff --git a/mm/2s2h/resource/importer/scenecommand/SetCsCameraFactory.h b/mm/2s2h/resource/importer/scenecommand/SetCsCameraFactory.h index 4be361364..ce05ec4b4 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetCsCameraFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetCsCameraFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetCsCameraFactory : public SceneCommandFactory { +namespace SOH { +class SetCsCameraFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; -}; - -class SetCsCameraFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; }; // namespace LUS diff --git a/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp index ce429d8c1..7d1eb0f81 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.cpp @@ -3,69 +3,15 @@ #include #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetCutscenesFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetCutscenes with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setCutscenes = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setCutscenes); - - ReadCommandId(setCutscenes, reader); - - setCutscenes->fileName = reader->ReadString(); - setCutscenes->cutscene = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str())); -} - -std::shared_ptr SetCutsceneFactoryMM::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetCutscenes with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetCutscenesFactoryMMV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setCutscenes = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setCutscenes); +namespace SOH { +std::shared_ptr SetCutsceneFactoryMM::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setCutscenes = std::make_shared(initData); ReadCommandId(setCutscenes, reader); size_t numCs = reader->ReadUByte(); + setCutscenes->entries.reserve(numCs); for (size_t i = 0; i < numCs; i++) { CutsceneScriptEntry entry; @@ -73,9 +19,11 @@ void LUS::SetCutscenesFactoryMMV0::ParseFileBinary(std::shared_ptr entry.exit = reader->ReadUInt16(); entry.entrance = reader->ReadUByte(); entry.flag = reader->ReadUByte(); - entry.data = ResourceGetDataByName(path.c_str()); + entry.data = std::static_pointer_cast( + LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(path.c_str()))->GetPointer(); setCutscenes->entries.emplace_back(entry); } -} -} // namespace LUS + return setCutscenes; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.h b/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.h index 905eab39a..ab71798ce 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetCutscenesFactory.h @@ -2,27 +2,11 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetCutscenesFactory : public SceneCommandFactory { +namespace SOH { +class SetCutsceneFactoryMM : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; -}; - -class SetCutscenesFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; - -class SetCutsceneFactoryMM : public SceneCommandFactory { - public: - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; -}; - -class SetCutscenesFactoryMMV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; }; }; // namespace LUS diff --git a/mm/2s2h/resource/importer/scenecommand/SetEchoSettingsFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetEchoSettingsFactory.cpp index c9bdfef54..7c9c31490 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetEchoSettingsFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetEchoSettingsFactory.cpp @@ -2,37 +2,15 @@ #include "2s2h/resource/type/scenecommand/SetEchoSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetEchoSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setEchoSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setEchoSettings); +namespace SOH { +std::shared_ptr +SetEchoSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setEchoSettings = std::make_shared(initData); ReadCommandId(setEchoSettings, reader); setEchoSettings->settings.echo = reader->ReadInt8(); -} -} // namespace LUS + return setEchoSettings; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetEchoSettingsFactory.h b/mm/2s2h/resource/importer/scenecommand/SetEchoSettingsFactory.h index 20673aa57..1b377d0c1 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetEchoSettingsFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetEchoSettingsFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetEchoSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetEchoSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetEchoSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetEntranceListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetEntranceListFactory.cpp index 34a50248a..e7060dc4f 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetEntranceListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetEntranceListFactory.cpp @@ -2,45 +2,24 @@ #include "2s2h/resource/type/scenecommand/SetEntranceList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetEntranceListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setEntranceList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setEntranceList); +namespace SOH { +std::shared_ptr +SetEntranceListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setEntranceList = std::make_shared(initData); ReadCommandId(setEntranceList, reader); setEntranceList->numEntrances = reader->ReadUInt32(); setEntranceList->entrances.reserve(setEntranceList->numEntrances); for (uint32_t i = 0; i < setEntranceList->numEntrances; i++) { - EntranceEntry entranceEntry; + EntranceEntry entranceEntry; - entranceEntry.spawn = reader->ReadInt8(); - entranceEntry.room = reader->ReadInt8(); + entranceEntry.spawn = reader->ReadInt8(); + entranceEntry.room = reader->ReadInt8(); setEntranceList->entrances.push_back(entranceEntry); } -} -} // namespace LUS + return setEntranceList; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetEntranceListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetEntranceListFactory.h index 2bb1186ba..f94a4ee37 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetEntranceListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetEntranceListFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetEntranceListFactory : public SceneCommandFactory { +namespace SOH { +class SetEntranceListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetEntranceListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetExitListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetExitListFactory.cpp index 4c5ddcb88..75b7cc30e 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetExitListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetExitListFactory.cpp @@ -2,40 +2,19 @@ #include "2s2h/resource/type/scenecommand/SetExitList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetExitListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared( initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetExitList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setExitList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setExitList); +namespace SOH { +std::shared_ptr +SetExitListFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setExitList = std::make_shared(initData); ReadCommandId(setExitList, reader); - + setExitList->numExits = reader->ReadUInt32(); setExitList->exits.reserve(setExitList->numExits); for (uint32_t i = 0; i < setExitList->numExits; i++) { setExitList->exits.push_back(reader->ReadUInt16()); } + return setExitList; } - } // namespace LUS diff --git a/mm/2s2h/resource/importer/scenecommand/SetExitListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetExitListFactory.h index e04ab4ba0..0d6fd6fc2 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetExitListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetExitListFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetExitListFactory : public SceneCommandFactory { +namespace SOH { +class SetExitListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; }; - -class SetExitListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetLightListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetLightListFactory.cpp index ab83635bf..36bd6f8b1 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetLightListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetLightListFactory.cpp @@ -2,34 +2,10 @@ #include "2s2h/resource/type/scenecommand/SetLightList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetLightListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetLightList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setLightList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setLightList); +namespace SOH { +std::shared_ptr +SetLightListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setLightList = std::make_shared(initData); ReadCommandId(setLightList, reader); @@ -40,7 +16,7 @@ void LUS::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr r light.type = reader->ReadUByte(); - light.params.point.x = reader->ReadInt16(); + light.params.point.x = reader->ReadInt16(); light.params.point.y = reader->ReadInt16(); light.params.point.z = reader->ReadInt16(); @@ -49,10 +25,11 @@ void LUS::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr r light.params.point.color[2] = reader->ReadUByte(); // b light.params.point.drawGlow = reader->ReadUByte(); - light.params.point.radius = reader->ReadInt16(); + light.params.point.radius = reader->ReadInt16(); - setLightList->lightList.push_back(light); + setLightList->lightList.emplace_back(light); } -} -} // namespace LUS + return setLightList; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetLightListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetLightListFactory.h index c099b82c5..5da751f0f 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetLightListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetLightListFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetLightListFactory : public SceneCommandFactory { +namespace SOH { +class SetLightListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetLightListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetLightingSettingsFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetLightingSettingsFactory.cpp index c13aeffec..b7f0fdd02 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetLightingSettingsFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetLightingSettingsFactory.cpp @@ -2,33 +2,11 @@ #include "2s2h/resource/type/scenecommand/SetLightingSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetLightingSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setLightingSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setLightingSettings); +namespace SOH { +std::shared_ptr +SetLightingSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setLightingSettings = std::make_shared(initData); ReadCommandId(setLightingSettings, reader); @@ -65,6 +43,7 @@ void LUS::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptrReadUInt16(); setLightingSettings->settings.push_back(lightSettings); } -} -} // namespace LUS + return setLightingSettings; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetLightingSettingsFactory.h b/mm/2s2h/resource/importer/scenecommand/SetLightingSettingsFactory.h index b25f85a97..405337915 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetLightingSettingsFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetLightingSettingsFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetLightingSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetLightingSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; }; - -class SetLightingSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/importer/scenecommand/SetMeshFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetMeshFactory.cpp index dcb3f4c10..1d8a360f0 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetMeshFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetMeshFactory.cpp @@ -3,34 +3,10 @@ #include "spdlog/spdlog.h" #include "libultraship/libultraship.h" -namespace LUS { -std::shared_ptr -SetMeshFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetMesh with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setMesh = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setMesh); +namespace SOH { +std::shared_ptr +SetMeshFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setMesh = std::make_shared(initData); ReadCommandId(setMesh, reader); @@ -46,7 +22,8 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader } else if (setMesh->meshHeader.base.type == 2) { setMesh->meshHeader.polygon2.num = polyNum; } else { - SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", setMesh->meshHeader.base.type); + SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", + setMesh->meshHeader.base.type); } } @@ -104,7 +81,8 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader if (setMesh->meshHeader.polygon1.format == 1) { setMesh->meshHeader.polygon1.single.source = image.source; setMesh->meshHeader.polygon1.single.unk_0C = image.unk_0C; - setMesh->meshHeader.polygon1.single.tlut = (void*)image.tlut; // OTRTODO: type of bgimage.tlut should be uintptr_t + setMesh->meshHeader.polygon1.single.tlut = + (void*)image.tlut; // OTRTODO: type of bgimage.tlut should be uintptr_t setMesh->meshHeader.polygon1.single.width = image.width; setMesh->meshHeader.polygon1.single.height = image.height; setMesh->meshHeader.polygon1.single.fmt = image.fmt; @@ -133,7 +111,7 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader setMesh->dlists.push_back(pType); } else if (setMesh->meshHeader.base.type == 2) { PolygonDlist2 dlist; - + int32_t polyType = reader->ReadInt8(); // Unused dlist.pos.x = reader->ReadInt16(); dlist.pos.y = reader->ReadInt16(); @@ -150,7 +128,8 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader setMesh->dlists2.push_back(dlist); } else { - SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", setMesh->meshHeader.base.type); + SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", + setMesh->meshHeader.base.type); } } @@ -162,8 +141,10 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader setMesh->meshHeader.polygon1.multi.list = setMesh->images.data(); setMesh->meshHeader.polygon1.dlist = (Gfx*)setMesh->dlists.data(); } else { - SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", setMesh->meshHeader.base.type); + SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", + setMesh->meshHeader.base.type); } -} -} // namespace LUS + return setMesh; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetMeshFactory.h b/mm/2s2h/resource/importer/scenecommand/SetMeshFactory.h index 3ae72fdbc..86f090dfb 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetMeshFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetMeshFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetMeshFactory : public SceneCommandFactory { +namespace SOH { +class SetMeshFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetMeshFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetMinimapChestsFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetMinimapChestsFactory.cpp index dae215ab1..d384e1f16 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetMinimapChestsFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetMinimapChestsFactory.cpp @@ -2,33 +2,11 @@ #include "2s2h/resource/type/scenecommand/SetMinimapChests.h" #include "spdlog/spdlog.h" -namespace LUS { +namespace SOH { -std::shared_ptr SetMinimapChestsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetMinimapChestsFactory with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void SetMinimapChestsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr chests = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, chests); +std::shared_ptr SetMinimapChestsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto chests = std::make_shared(initData); ReadCommandId(chests, reader); @@ -45,6 +23,7 @@ void SetMinimapChestsFactoryV0::ParseFileBinary(std::shared_ptr re d.unk_8 = reader->ReadUInt16(); chests->chests.emplace_back(d); } -} + return chests; +} } // namespace LUS \ No newline at end of file diff --git a/mm/2s2h/resource/importer/scenecommand/SetMinimapChestsFactory.h b/mm/2s2h/resource/importer/scenecommand/SetMinimapChestsFactory.h index 941405c40..1dbb597a7 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetMinimapChestsFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetMinimapChestsFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetMinimapChestsFactory : public SceneCommandFactory { +namespace SOH { +class SetMinimapChestsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; -}; - -class SetMinimapChestsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; }; } \ No newline at end of file diff --git a/mm/2s2h/resource/importer/scenecommand/SetMinimapListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetMinimapListFactory.cpp index 43eb4b496..4a0db83ca 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetMinimapListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetMinimapListFactory.cpp @@ -2,32 +2,10 @@ #include "2s2h/resource/type/scenecommand/SetMinimapList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetMinimapListFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetMinimapListFactory with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} -void SetMinimapListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr mapList = std::static_pointer_cast(resource); - - ResourceVersionFactory::ParseFileBinary(reader, mapList); +namespace SOH { +std::shared_ptr SetMinimapListFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto mapList = std::make_shared(initData); ReadCommandId(mapList, reader); @@ -46,5 +24,8 @@ void SetMinimapListFactoryV0::ParseFileBinary(std::shared_ptr read mapList->entries.emplace_back(data); } mapList->list.entry = mapList->entries.data(); + + return mapList; + } } // namespace LUS diff --git a/mm/2s2h/resource/importer/scenecommand/SetMinimapListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetMinimapListFactory.h index d8a5fd643..2659e9e9b 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetMinimapListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetMinimapListFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetMinimapListFactory : public SceneCommandFactory { +namespace SOH { +class SetMinimapListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; -}; - -class SetMinimapListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; }; }; // namespace LUS \ No newline at end of file diff --git a/mm/2s2h/resource/importer/scenecommand/SetObjectListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetObjectListFactory.cpp index 274407c00..c7cf20b2b 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetObjectListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetObjectListFactory.cpp @@ -2,33 +2,10 @@ #include "2s2h/resource/type/scenecommand/SetObjectList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetObjectListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetObjectList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setObjectList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setObjectList); +namespace SOH { +std::shared_ptr +SetObjectListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setObjectList = std::make_shared(initData); ReadCommandId(setObjectList, reader); @@ -37,6 +14,7 @@ void LUS::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr for (uint32_t i = 0; i < setObjectList->numObjects; i++) { setObjectList->objects.push_back(reader->ReadUInt16()); } -} -} // namespace LUS + return setObjectList; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetObjectListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetObjectListFactory.h index b977576d3..2e493ec3a 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetObjectListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetObjectListFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetObjectListFactory : public SceneCommandFactory { +namespace SOH { +class SetObjectListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetObjectListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp index a361a0915..ec6d7e4bf 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.cpp @@ -3,70 +3,11 @@ #include "spdlog/spdlog.h" #include -namespace LUS { -std::shared_ptr -SetPathwaysFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetPathways with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setPathways = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setPathways); - - ReadCommandId(setPathways, reader); - - setPathways->numPaths = reader->ReadUInt32(); - setPathways->paths.reserve(setPathways->numPaths); - for (uint32_t i = 0; i < setPathways->numPaths; i++) { - std::string pathFileName = reader->ReadString(); - auto path = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str())); - setPathways->paths.push_back(path->GetPointer()); - } -} - -std::shared_ptr SetPathwaysMMFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetPathwaysMM with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetPathwaysMMFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setPathways = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setPathways); - +namespace SOH { +std::shared_ptr SetPathwaysMMFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setPathways = std::make_shared(initData); + ReadCommandId(setPathways, reader); setPathways->numPaths = reader->ReadUInt32(); @@ -77,6 +18,6 @@ void LUS::SetPathwaysMMFactoryV0::ParseFileBinary(std::shared_ptr LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str())); setPathways->paths.push_back(path->GetPointer()); } + return setPathways; } - -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.h b/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.h index 544ef02dc..6254a6938 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetPathwaysFactory.h @@ -2,27 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetPathwaysFactory : public SceneCommandFactory { +namespace SOH { +class SetPathwaysMMFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; }; - -class SetPathwaysFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; - -class SetPathwaysMMFactory : public SceneCommandFactory { - public: - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; -}; - -class SetPathwaysMMFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; - }; // namespace LUS diff --git a/mm/2s2h/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp index e2c5df85f..a7b843496 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp @@ -2,68 +2,10 @@ #include "2s2h/resource/type/scenecommand/SetRoomBehavior.h" #include "spdlog/spdlog.h" -namespace LUS { -// OOT -#if 0 -std::shared_ptr -SetRoomBehaviorFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetRoomBehaviorFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setRoomBehavior = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior); - - ReadCommandId(setRoomBehavior, reader); - - setRoomBehavior->roomBehavior.gameplayFlags = reader->ReadInt8(); - setRoomBehavior->roomBehavior.gameplayFlags2 = reader->ReadInt32(); -} -#endif -// MM - -std::shared_ptr SetRoomBehaviorMMFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void SetRoomBehaviorMMFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setRoomBehavior = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior); +namespace SOH { +std::shared_ptr SetRoomBehaviorMMFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setRoomBehavior = std::make_shared(initData); ReadCommandId(setRoomBehavior, reader); @@ -73,6 +15,7 @@ void SetRoomBehaviorMMFactoryV0::ParseFileBinary(std::shared_ptr r setRoomBehavior->roomBehavior.msgCtxUnk = reader->ReadInt8(); setRoomBehavior->roomBehavior.enablePointLights = reader->ReadInt8(); setRoomBehavior->roomBehavior.kankyoContextUnkE2 = reader->ReadInt8(); -} -} // namespace LUS + return setRoomBehavior; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetRoomBehaviorFactory.h b/mm/2s2h/resource/importer/scenecommand/SetRoomBehaviorFactory.h index a449a1c8f..a8a2c5054 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetRoomBehaviorFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetRoomBehaviorFactory.h @@ -2,27 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetRoomBehaviorFactory : public SceneCommandFactory { +namespace SOH { +class SetRoomBehaviorMMFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; }; - -class SetRoomBehaviorFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; - -class SetRoomBehaviorMMFactory : public SceneCommandFactory { - public: - std::shared_ptr ReadResource(std::shared_ptr initData, - std::shared_ptr reader) override; -}; - -class SetRoomBehaviorMMFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; - -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetRoomListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetRoomListFactory.cpp index ac4040afa..f455828c7 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetRoomListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetRoomListFactory.cpp @@ -2,49 +2,27 @@ #include "2s2h/resource/type/scenecommand/SetRoomList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetRoomListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetRoomList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetRoomListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setRoomList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setRoomList); +namespace SOH { +std::shared_ptr +SetRoomListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setRoomList = std::make_shared(initData); ReadCommandId(setRoomList, reader); setRoomList->numRooms = reader->ReadInt32(); setRoomList->rooms.reserve(setRoomList->numRooms); for (uint32_t i = 0; i < setRoomList->numRooms; i++) { - RomFile room; + RomFile room; - setRoomList->fileNames.push_back(reader->ReadString()); + setRoomList->fileNames.push_back(reader->ReadString()); - room.fileName = (char*)setRoomList->fileNames.back().c_str(); - room.vromStart = reader->ReadInt32(); - room.vromEnd = reader->ReadInt32(); + room.fileName = (char*)setRoomList->fileNames.back().c_str(); + room.vromStart = reader->ReadInt32(); + room.vromEnd = reader->ReadInt32(); setRoomList->rooms.push_back(room); } -} -} // namespace LUS + return setRoomList; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetRoomListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetRoomListFactory.h index eeb099aa8..02bf2468f 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetRoomListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetRoomListFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetRoomListFactory : public SceneCommandFactory { +namespace SOH { +class SetRoomListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetRoomListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp index c2670e0fd..00b2ab343 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp @@ -2,37 +2,16 @@ #include "2s2h/resource/type/scenecommand/SetSkyboxModifier.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetSkyboxModifierFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetSkyboxModifierFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setSkyboxModifier = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setSkyboxModifier); +namespace SOH { +std::shared_ptr SetSkyboxModifierFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setSkyboxModifier = std::make_shared(initData); ReadCommandId(setSkyboxModifier, reader); setSkyboxModifier->modifier.skyboxDisabled = reader->ReadInt8(); setSkyboxModifier->modifier.sunMoonDisabled = reader->ReadInt8(); -} -} // namespace LUS + return setSkyboxModifier; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetSkyboxModifierFactory.h b/mm/2s2h/resource/importer/scenecommand/SetSkyboxModifierFactory.h index 3880751fe..dc7919b82 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetSkyboxModifierFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetSkyboxModifierFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetSkyboxModifierFactory : public SceneCommandFactory { +namespace SOH { +class SetSkyboxModifierFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetSkyboxModifierFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp index 8ac3b91a4..2f574c6ce 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp @@ -2,32 +2,10 @@ #include "2s2h/resource/type/scenecommand/SetSkyboxSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetSkyboxSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setSkyboxSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setSkyboxSettings); +namespace SOH { +std::shared_ptr SetSkyboxSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setSkyboxSettings = std::make_shared(initData); ReadCommandId(setSkyboxSettings, reader); @@ -35,6 +13,7 @@ void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr r setSkyboxSettings->settings.skyboxId = reader->ReadInt8(); setSkyboxSettings->settings.weather = reader->ReadInt8(); setSkyboxSettings->settings.indoors = reader->ReadInt8(); -} -} // namespace LUS + return setSkyboxSettings; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetSkyboxSettingsFactory.h b/mm/2s2h/resource/importer/scenecommand/SetSkyboxSettingsFactory.h index c75c86673..7a96d6cfc 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetSkyboxSettingsFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetSkyboxSettingsFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetSkyboxSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetSkyboxSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetSkyboxSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetSoundSettingsFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetSoundSettingsFactory.cpp index 98ee97f03..e10d73550 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetSoundSettingsFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetSoundSettingsFactory.cpp @@ -2,38 +2,17 @@ #include "2s2h/resource/type/scenecommand/SetSoundSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetSoundSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setSoundSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setSoundSettings); +namespace SOH { +std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setSoundSettings = std::make_shared(initData); ReadCommandId(setSoundSettings, reader); setSoundSettings->settings.reverb = reader->ReadInt8(); setSoundSettings->settings.natureAmbienceId = reader->ReadInt8(); setSoundSettings->settings.seqId = reader->ReadInt8(); -} -} // namespace LUS + return setSoundSettings; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetSoundSettingsFactory.h b/mm/2s2h/resource/importer/scenecommand/SetSoundSettingsFactory.h index 235c617a2..dd89af87b 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetSoundSettingsFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetSoundSettingsFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetSoundSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetSoundSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetSoundSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp index 35fc6614e..1d295651c 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp @@ -2,37 +2,16 @@ #include "2s2h/resource/type/scenecommand/SetSpecialObjects.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetSpecialObjectsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr){ - SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetSpecialObjectsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setSpecialObjects = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setSpecialObjects); +namespace SOH { +std::shared_ptr SetSpecialObjectsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setSpecialObjects = std::make_shared(initData); ReadCommandId(setSpecialObjects, reader); setSpecialObjects->specialObjects.elfMessage = reader->ReadInt8(); setSpecialObjects->specialObjects.globalObject = reader->ReadInt16(); -} -} // namespace LUS + return setSpecialObjects; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetSpecialObjectsFactory.h b/mm/2s2h/resource/importer/scenecommand/SetSpecialObjectsFactory.h index b62180a45..471690eb9 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetSpecialObjectsFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetSpecialObjectsFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetSpecialObjectsFactory : public SceneCommandFactory { +namespace SOH { +class SetSpecialObjectsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetSpecialObjectsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetStartPositionListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetStartPositionListFactory.cpp index 9d95a01ce..8432035d9 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetStartPositionListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetStartPositionListFactory.cpp @@ -2,54 +2,30 @@ #include "2s2h/resource/type/scenecommand/SetStartPositionList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetStartPositionListFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) - { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetStartPositionListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setStartPositionList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setStartPositionList); +namespace SOH { +std::shared_ptr SetStartPositionListFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setStartPositionList = std::make_shared(initData); ReadCommandId(setStartPositionList, reader); setStartPositionList->numStartPositions = reader->ReadUInt32(); setStartPositionList->startPositions.reserve(setStartPositionList->numStartPositions); for (uint32_t i = 0; i < setStartPositionList->numStartPositions; i++) { - ActorEntry entry; + ActorEntry entry; - entry.id = reader->ReadUInt16(); - entry.pos.x = reader->ReadInt16(); - entry.pos.y = reader->ReadInt16(); - entry.pos.z = reader->ReadInt16(); - entry.rot.x = reader->ReadInt16(); - entry.rot.y = reader->ReadInt16(); - entry.rot.z = reader->ReadInt16(); - entry.params = reader->ReadUInt16(); + entry.id = reader->ReadUInt16(); + entry.pos.x = reader->ReadInt16(); + entry.pos.y = reader->ReadInt16(); + entry.pos.z = reader->ReadInt16(); + entry.rot.x = reader->ReadInt16(); + entry.rot.y = reader->ReadInt16(); + entry.rot.z = reader->ReadInt16(); + entry.params = reader->ReadUInt16(); setStartPositionList->startPositions.push_back(entry); } -} -} // namespace LUS + return setStartPositionList; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetStartPositionListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetStartPositionListFactory.h index b029f3a1e..c1e92b4c3 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetStartPositionListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetStartPositionListFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetStartPositionListFactory : public SceneCommandFactory { +namespace SOH { +class SetStartPositionListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetStartPositionListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetTimeSettingsFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetTimeSettingsFactory.cpp index e3f2d77e5..73bd93a22 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetTimeSettingsFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetTimeSettingsFactory.cpp @@ -2,38 +2,18 @@ #include "2s2h/resource/type/scenecommand/SetTimeSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetTimeSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetTimeSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setTimeSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setTimeSettings); +namespace SOH { +std::shared_ptr SetTimeSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setTimeSettings = std::make_shared(initData); ReadCommandId(setTimeSettings, reader); - + setTimeSettings->settings.hour = reader->ReadInt8(); setTimeSettings->settings.minute = reader->ReadInt8(); setTimeSettings->settings.timeIncrement = reader->ReadInt8(); + + return setTimeSettings; } } // namespace LUS diff --git a/mm/2s2h/resource/importer/scenecommand/SetTimeSettingsFactory.h b/mm/2s2h/resource/importer/scenecommand/SetTimeSettingsFactory.h index 1482c2892..10d568a39 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetTimeSettingsFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetTimeSettingsFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetTimeSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetTimeSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetTimeSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace LUS diff --git a/mm/2s2h/resource/importer/scenecommand/SetTransitionActorListFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetTransitionActorListFactory.cpp index 611897fbe..9688d137e 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetTransitionActorListFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetTransitionActorListFactory.cpp @@ -2,33 +2,11 @@ #include "2s2h/resource/type/scenecommand/SetTransitionActorList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetTransitionActorListFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setTransitionActorList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setTransitionActorList); - +namespace SOH { +std::shared_ptr SetTransitionActorListFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setTransitionActorList = std::make_shared(initData); + ReadCommandId(setTransitionActorList, reader); setTransitionActorList->numTransitionActors = reader->ReadUInt32(); @@ -49,6 +27,7 @@ void LUS::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptrtransitionActorList.push_back(entry); } -} -} // namespace LUS + return setTransitionActorList; +} +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetTransitionActorListFactory.h b/mm/2s2h/resource/importer/scenecommand/SetTransitionActorListFactory.h index d300fdf3c..286d8cd1f 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetTransitionActorListFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetTransitionActorListFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetTransitionActorListFactory : public SceneCommandFactory { +namespace SOH { +class SetTransitionActorListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetTransitionActorListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetWindSettingsFactory.cpp b/mm/2s2h/resource/importer/scenecommand/SetWindSettingsFactory.cpp index 74b3e78ab..01dab3730 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetWindSettingsFactory.cpp +++ b/mm/2s2h/resource/importer/scenecommand/SetWindSettingsFactory.cpp @@ -2,39 +2,19 @@ #include "2s2h/resource/type/scenecommand/SetWindSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetWindSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetWindSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetWindSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setWind = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setWind); +namespace SOH { +std::shared_ptr SetWindSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setWind = std::make_shared(initData); ReadCommandId(setWind, reader); - + setWind->settings.windWest = reader->ReadInt8(); setWind->settings.windVertical = reader->ReadInt8(); setWind->settings.windSouth = reader->ReadInt8(); setWind->settings.windSpeed = reader->ReadUByte(); + + return setWind; } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/importer/scenecommand/SetWindSettingsFactory.h b/mm/2s2h/resource/importer/scenecommand/SetWindSettingsFactory.h index b4fb4d615..6da192df2 100644 --- a/mm/2s2h/resource/importer/scenecommand/SetWindSettingsFactory.h +++ b/mm/2s2h/resource/importer/scenecommand/SetWindSettingsFactory.h @@ -2,15 +2,10 @@ #include "2s2h/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetWindSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetWindSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; -}; - -class SetWindSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr initData, + std::shared_ptr reader) override; }; }; // namespace LUS diff --git a/mm/2s2h/resource/type/2shResourceType.h b/mm/2s2h/resource/type/2shResourceType.h new file mode 100644 index 000000000..f2124ab8b --- /dev/null +++ b/mm/2s2h/resource/type/2shResourceType.h @@ -0,0 +1,27 @@ +#pragma once + +namespace SOH { +enum class ResourceType { + SOH_Animation = 0x4F414E4D, // OANM + SOH_PlayerAnimation = 0x4F50414D, // OPAM + SOH_Room = 0x4F524F4D, // OROM + SOH_CollisionHeader = 0x4F434F4C, // OCOL + SOH_Skeleton = 0x4F534B4C, // OSKL + SOH_SkeletonLimb = 0x4F534C42, // OSLB + SOH_Path = 0x4F505448, // OPTH + SOH_Cutscene = 0x4F435654, // OCUT + SOH_Text = 0x4F545854, // OTXT + SOH_Audio = 0x4F415544, // OAUD + SOH_AudioSample = 0x4F534D50, // OSMP + SOH_AudioSoundFont = 0x4F534654, // OSFT + SOH_AudioSequence = 0x4F534551, // OSEQ + SOH_Background = 0x4F424749, // OBGI + SOH_SceneCommand = 0x4F52434D, // ORCM + + TSH_TextMM = 0x4F54584D, // OTXM + + TSH_TexAnim = 0x4F54414E, // OTAN + TSH_CKeyFrameAnim = 0x4F4B4641, // OKFA + TSH_CKeyFrameSkel = 0x4F4B4653 // OKFS +}; +} // namespace SOH diff --git a/mm/2s2h/resource/type/Animation.cpp b/mm/2s2h/resource/type/Animation.cpp index 46327c732..d11d05394 100644 --- a/mm/2s2h/resource/type/Animation.cpp +++ b/mm/2s2h/resource/type/Animation.cpp @@ -1,6 +1,6 @@ #include "Animation.h" -namespace LUS { +namespace SOH { AnimationData* Animation::GetPointer() { return &animationData; } @@ -18,4 +18,4 @@ size_t Animation::GetPointerSize() { return 0; } } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/Animation.h b/mm/2s2h/resource/type/Animation.h index 3d6b810bf..9ca22038e 100644 --- a/mm/2s2h/resource/type/Animation.h +++ b/mm/2s2h/resource/type/Animation.h @@ -3,7 +3,7 @@ #include "Resource.h" #include -namespace LUS { +namespace SOH { enum class AnimationType { Normal = 0, Link = 1, @@ -63,11 +63,12 @@ namespace LUS { TransformUpdateIndex transformUpdateIndex; }; - class Animation : public Resource { + class Animation : public LUS::Resource { public: using Resource::Resource; - Animation() : Resource(std::shared_ptr()) {} + Animation() : Resource(std::shared_ptr()) { + } AnimationData* GetPointer(); size_t GetPointerSize(); @@ -84,4 +85,4 @@ namespace LUS { std::vector transformDataArr; std::vector copyValuesArr; }; -}; // namespace LUS \ No newline at end of file +}; // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/AudioSample.cpp b/mm/2s2h/resource/type/AudioSample.cpp index 951aae6c1..288765822 100644 --- a/mm/2s2h/resource/type/AudioSample.cpp +++ b/mm/2s2h/resource/type/AudioSample.cpp @@ -1,6 +1,6 @@ #include "AudioSample.h" -namespace LUS { +namespace SOH { Sample* AudioSample::GetPointer() { return &sample; } @@ -8,4 +8,4 @@ Sample* AudioSample::GetPointer() { size_t AudioSample::GetPointerSize() { return sizeof(Sample); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/AudioSample.h b/mm/2s2h/resource/type/AudioSample.h index eda8aa456..8ff320585 100644 --- a/mm/2s2h/resource/type/AudioSample.h +++ b/mm/2s2h/resource/type/AudioSample.h @@ -5,7 +5,7 @@ #include "Resource.h" #include -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ uintptr_t start; /* 0x04 */ uintptr_t end; @@ -39,11 +39,11 @@ namespace LUS { s32 sampleRate; // For wav samples only... } Sample; // size = 0x10 - class AudioSample : public Resource { + class AudioSample : public LUS::Resource { public: using Resource::Resource; - AudioSample() : Resource(std::shared_ptr()) {} + AudioSample() : Resource(std::shared_ptr()) {} Sample* GetPointer(); size_t GetPointerSize(); @@ -58,4 +58,4 @@ namespace LUS { uint32_t bookDataCount; std::vector bookData; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/AudioSequence.cpp b/mm/2s2h/resource/type/AudioSequence.cpp index c09514a67..41029d47d 100644 --- a/mm/2s2h/resource/type/AudioSequence.cpp +++ b/mm/2s2h/resource/type/AudioSequence.cpp @@ -1,6 +1,6 @@ #include "AudioSequence.h" -namespace LUS { +namespace SOH { Sequence* AudioSequence::GetPointer() { return &sequence; @@ -9,4 +9,4 @@ Sequence* AudioSequence::GetPointer() { size_t AudioSequence::GetPointerSize() { return sizeof(Sequence); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/AudioSequence.h b/mm/2s2h/resource/type/AudioSequence.h index 2b2bb8be9..dd4030562 100644 --- a/mm/2s2h/resource/type/AudioSequence.h +++ b/mm/2s2h/resource/type/AudioSequence.h @@ -5,7 +5,7 @@ #include "Resource.h" #include -namespace LUS { +namespace SOH { typedef struct { char* seqData; @@ -17,11 +17,11 @@ typedef struct { uint8_t fonts[16]; } Sequence; -class AudioSequence : public Resource { +class AudioSequence : public LUS::Resource { public: using Resource::Resource; - AudioSequence() : Resource(std::shared_ptr()) {} + AudioSequence() : Resource(std::shared_ptr()) {} Sequence* GetPointer(); size_t GetPointerSize(); @@ -29,4 +29,4 @@ public: Sequence sequence; std::vector sequenceData; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/AudioSoundFont.cpp b/mm/2s2h/resource/type/AudioSoundFont.cpp index 43ac40abf..12218cb64 100644 --- a/mm/2s2h/resource/type/AudioSoundFont.cpp +++ b/mm/2s2h/resource/type/AudioSoundFont.cpp @@ -1,6 +1,6 @@ #include "AudioSoundFont.h" -namespace LUS { +namespace SOH { SoundFont* AudioSoundFont::GetPointer() { return &soundFont; } @@ -8,4 +8,4 @@ SoundFont* AudioSoundFont::GetPointer() { size_t AudioSoundFont::GetPointerSize() { return sizeof(SoundFont); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/AudioSoundFont.h b/mm/2s2h/resource/type/AudioSoundFont.h index 99b18b401..1dbf33937 100644 --- a/mm/2s2h/resource/type/AudioSoundFont.h +++ b/mm/2s2h/resource/type/AudioSoundFont.h @@ -6,7 +6,7 @@ #include "2s2h/resource/type/AudioSample.h" #include -namespace LUS { +namespace SOH { typedef struct { /* 0x0 */ s16 delay; @@ -52,11 +52,11 @@ typedef struct { s32 fntIndex; } SoundFont; // size = 0x14 -class AudioSoundFont : public Resource { +class AudioSoundFont : public LUS::Resource { public: using Resource::Resource; - AudioSoundFont() : Resource(std::shared_ptr()) {} + AudioSoundFont() : Resource(std::shared_ptr()) {} SoundFont* GetPointer(); size_t GetPointerSize(); @@ -81,4 +81,4 @@ public: SoundFont soundFont; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/Background.cpp b/mm/2s2h/resource/type/Background.cpp index bc1047b5c..5465b1ad9 100644 --- a/mm/2s2h/resource/type/Background.cpp +++ b/mm/2s2h/resource/type/Background.cpp @@ -1,6 +1,6 @@ #include "Background.h" -namespace LUS { +namespace SOH { uint8_t* Background::GetPointer() { return Data.data(); } @@ -8,4 +8,4 @@ uint8_t* Background::GetPointer() { size_t Background::GetPointerSize() { return Data.size() * sizeof(uint8_t); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/Background.h b/mm/2s2h/resource/type/Background.h index 7f22658e0..6c10759d1 100644 --- a/mm/2s2h/resource/type/Background.h +++ b/mm/2s2h/resource/type/Background.h @@ -2,16 +2,16 @@ #include "resource/Resource.h" -namespace LUS { -class Background : public Resource { +namespace SOH { +class Background : public LUS::Resource { public: using Resource::Resource; - Background() : Resource(std::shared_ptr()) {} + Background() : Resource(std::shared_ptr()) {} uint8_t* GetPointer(); size_t GetPointerSize(); std::vector Data; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/CollisionHeader.cpp b/mm/2s2h/resource/type/CollisionHeader.cpp index 5625d2b59..dbfd737ee 100644 --- a/mm/2s2h/resource/type/CollisionHeader.cpp +++ b/mm/2s2h/resource/type/CollisionHeader.cpp @@ -1,6 +1,6 @@ #include "CollisionHeader.h" -namespace LUS { +namespace SOH { CollisionHeaderData* CollisionHeader::GetPointer() { return &collisionHeaderData; } @@ -8,4 +8,4 @@ CollisionHeaderData* CollisionHeader::GetPointer() { size_t CollisionHeader::GetPointerSize() { return sizeof(collisionHeaderData); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/CollisionHeader.h b/mm/2s2h/resource/type/CollisionHeader.h index e401aa7f5..6f6a9546a 100644 --- a/mm/2s2h/resource/type/CollisionHeader.h +++ b/mm/2s2h/resource/type/CollisionHeader.h @@ -6,7 +6,7 @@ #include #include "z64math.h" -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ u16 type; @@ -67,11 +67,11 @@ typedef struct { size_t cameraDataListLen; // OTRTODO: Added to allow for bounds checking the cameraDataList. } CollisionHeaderData; // original name: BGDataInfo -class CollisionHeader : public Resource { +class CollisionHeader : public LUS::Resource { public: using Resource::Resource; - CollisionHeader() : Resource(std::shared_ptr()) {} + CollisionHeader() : Resource(std::shared_ptr()) {} CollisionHeaderData* GetPointer(); size_t GetPointerSize(); @@ -95,4 +95,4 @@ public: std::vector waterBoxes; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/Cutscene.cpp b/mm/2s2h/resource/type/Cutscene.cpp index c7e98062a..60440ceb2 100644 --- a/mm/2s2h/resource/type/Cutscene.cpp +++ b/mm/2s2h/resource/type/Cutscene.cpp @@ -1,7 +1,7 @@ #include "Cutscene.h" #include -namespace LUS { +namespace SOH { uint32_t* Cutscene::GetPointer() { return commands.data(); } @@ -9,4 +9,4 @@ uint32_t* Cutscene::GetPointer() { size_t Cutscene::GetPointerSize() { return commands.size() * sizeof(uint32_t); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/Cutscene.h b/mm/2s2h/resource/type/Cutscene.h index 5bd268e61..3ca8b3d50 100644 --- a/mm/2s2h/resource/type/Cutscene.h +++ b/mm/2s2h/resource/type/Cutscene.h @@ -7,7 +7,7 @@ #include "Vec3f.h" #include "Color3b.h" -namespace LUS { +namespace SOH { enum class CutsceneCommands { Cmd00 = 0x0000, @@ -44,11 +44,11 @@ enum class CutsceneCommands { Error = 0xFEAF, }; -class Cutscene : public Resource { +class Cutscene : public LUS::Resource { public: using Resource::Resource; - Cutscene() : Resource(std::shared_ptr()) {} + Cutscene() : Resource(std::shared_ptr()) {} uint32_t* GetPointer(); size_t GetPointerSize(); @@ -57,7 +57,7 @@ class Cutscene : public Resource { uint32_t endFrame; std::vector commands; }; -} // namespace LUS +} // namespace SOH ///////////// diff --git a/mm/2s2h/resource/type/KeyFrame.cpp b/mm/2s2h/resource/type/KeyFrame.cpp index 6fc9bd567..06107fe7f 100644 --- a/mm/2s2h/resource/type/KeyFrame.cpp +++ b/mm/2s2h/resource/type/KeyFrame.cpp @@ -1,8 +1,8 @@ #include "KeyFrame.h" -namespace LUS { +namespace SOH { -LUS::KeyFrameSkel::~KeyFrameSkel() { +KeyFrameSkel::~KeyFrameSkel() { delete[] skelData.limbsFlex; } @@ -15,14 +15,14 @@ size_t KeyFrameSkel::GetPointerSize() { } -LUS::KeyFrameAnim::~KeyFrameAnim() { +KeyFrameAnim::~KeyFrameAnim() { delete[] animData.bitFlags; delete[] animData.keyFrames; delete[] animData.kfNums; delete[] animData.presetValues; } -KeyFrameAnimationData* LUS::KeyFrameAnim::GetPointer() { +KeyFrameAnimationData* KeyFrameAnim::GetPointer() { return &animData; } diff --git a/mm/2s2h/resource/type/KeyFrame.h b/mm/2s2h/resource/type/KeyFrame.h index 7e5d534f5..4a1a789b1 100644 --- a/mm/2s2h/resource/type/KeyFrame.h +++ b/mm/2s2h/resource/type/KeyFrame.h @@ -3,7 +3,7 @@ #include "Resource.h" #include -namespace LUS { +namespace SOH { typedef struct Vec3s { s16 x; @@ -56,11 +56,11 @@ typedef struct { /* 0x12 */ s16 duration; } KeyFrameAnimationData; // Size = 0x14 -class KeyFrameSkel : public Resource { +class KeyFrameSkel : public LUS::Resource { public: using Resource::Resource; - KeyFrameSkel() : Resource(std::shared_ptr()) { + KeyFrameSkel() : Resource(std::shared_ptr()) { } ~KeyFrameSkel(); @@ -70,11 +70,11 @@ class KeyFrameSkel : public Resource { KeyFrameSkeletonData skelData; }; -class KeyFrameAnim : public Resource { +class KeyFrameAnim : public LUS::Resource { public: using Resource::Resource; - KeyFrameAnim() : Resource(std::shared_ptr()) { + KeyFrameAnim() : Resource(std::shared_ptr()) { } ~KeyFrameAnim(); @@ -84,4 +84,4 @@ class KeyFrameAnim : public Resource { KeyFrameAnimationData animData; }; -} // namespace LUS \ No newline at end of file +} // namespace SOH diff --git a/mm/2s2h/resource/type/Path.cpp b/mm/2s2h/resource/type/Path.cpp index 8ca2ac78d..5dc0a7422 100644 --- a/mm/2s2h/resource/type/Path.cpp +++ b/mm/2s2h/resource/type/Path.cpp @@ -1,19 +1,11 @@ #include "Path.h" -namespace LUS { -PathData* Path::GetPointer() { - return pathData.data(); -} - -size_t Path::GetPointerSize() { - return pathData.size() * sizeof(PathData); -} - +namespace SOH { PathDataMM* PathMM::GetPointer() { return pathData.data(); } size_t PathMM::GetPointerSize() { - return pathData.size() * sizeof(PathData); + return pathData.size() * sizeof(PathDataMM); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/Path.h b/mm/2s2h/resource/type/Path.h index 045764cc8..88872b570 100644 --- a/mm/2s2h/resource/type/Path.h +++ b/mm/2s2h/resource/type/Path.h @@ -6,13 +6,7 @@ #include #include "z64math.h" -namespace LUS { - -typedef struct { - /* 0x00 */ u8 count; // number of points in the path - /* 0x04 */ Vec3s* points; // Segment Address to the array of points -} PathData; // size = 0x8 - +namespace SOH { typedef struct { /* 0x0 */ u8 count; // Number of points in the path /* 0x1 */ u8 additionalPathIndex; @@ -20,25 +14,11 @@ typedef struct { /* 0x4 */ Vec3s* points; // Segment Address to the array of points } PathDataMM; // size = 0x8 -class Path : public Resource { -public: - using Resource::Resource; - - Path() : Resource(std::shared_ptr()) {} - - PathData* GetPointer(); - size_t GetPointerSize(); - - uint32_t numPaths; - std::vector pathData; - std::vector> paths; -}; - -class PathMM : public Resource { +class PathMM : public LUS::Resource { public: using Resource::Resource; - PathMM() : Resource(std::shared_ptr()) { + PathMM() : Resource(std::shared_ptr()) { } PathDataMM* GetPointer(); @@ -49,4 +29,4 @@ class PathMM : public Resource { std::vector> paths; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/PlayerAnimation.cpp b/mm/2s2h/resource/type/PlayerAnimation.cpp index 55925f49c..c9269061e 100644 --- a/mm/2s2h/resource/type/PlayerAnimation.cpp +++ b/mm/2s2h/resource/type/PlayerAnimation.cpp @@ -1,7 +1,7 @@ #include "PlayerAnimation.h" #include -namespace LUS { +namespace SOH { int16_t* PlayerAnimation::GetPointer() { return limbRotData.data(); } @@ -9,4 +9,4 @@ int16_t* PlayerAnimation::GetPointer() { size_t PlayerAnimation::GetPointerSize() { return limbRotData.size() * sizeof(int16_t); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/PlayerAnimation.h b/mm/2s2h/resource/type/PlayerAnimation.h index 4eb51b139..5d5af68f2 100644 --- a/mm/2s2h/resource/type/PlayerAnimation.h +++ b/mm/2s2h/resource/type/PlayerAnimation.h @@ -7,17 +7,17 @@ #include "Vec3f.h" #include "Color3b.h" -namespace LUS { +namespace SOH { -class PlayerAnimation : public Resource { +class PlayerAnimation : public LUS::Resource { public: using Resource::Resource; - PlayerAnimation() : Resource(std::shared_ptr()) {} + PlayerAnimation() : Resource(std::shared_ptr()) {} int16_t* GetPointer(); size_t GetPointerSize(); std::vector limbRotData; }; -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/Scene.cpp b/mm/2s2h/resource/type/Scene.cpp index bfe219e54..15829c40e 100644 --- a/mm/2s2h/resource/type/Scene.cpp +++ b/mm/2s2h/resource/type/Scene.cpp @@ -1,6 +1,6 @@ #include "Scene.h" -namespace LUS { +namespace SOH { void* Scene::GetPointer() { // Scene is a special type that requries C++ processing. As such, we return nothing. return nullptr; @@ -9,4 +9,4 @@ void* Scene::GetPointer() { size_t Scene::GetPointerSize() { return 0; } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/Scene.h b/mm/2s2h/resource/type/Scene.h index f726da359..130266cb6 100644 --- a/mm/2s2h/resource/type/Scene.h +++ b/mm/2s2h/resource/type/Scene.h @@ -2,22 +2,21 @@ #include #include -#include #include "Resource.h" #include "scenecommand/SceneCommand.h" #include -namespace LUS { +namespace SOH { -class Scene : public Resource { +class Scene : public LUS::Resource { public: using Resource::Resource; - Scene() : Resource(std::shared_ptr()) {} + Scene() : Resource(std::shared_ptr()) {} void* GetPointer(); - size_t GetPointerSize(); + size_t GetPointerSize(); - std::vector> commands; + std::vector> commands; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/Skeleton.cpp b/mm/2s2h/resource/type/Skeleton.cpp index 7b9003bab..c3e509cf6 100644 --- a/mm/2s2h/resource/type/Skeleton.cpp +++ b/mm/2s2h/resource/type/Skeleton.cpp @@ -3,7 +3,7 @@ #include "2s2h/BenPort.h" #include "libultraship/libultraship.h" -namespace LUS { +namespace SOH { SkeletonData* Skeleton::GetPointer() { return &skeletonData; } @@ -79,4 +79,4 @@ void SkeletonPatcher::UpdateSkeletons() { } } } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/Skeleton.h b/mm/2s2h/resource/type/Skeleton.h index 490614a44..81aa90c68 100644 --- a/mm/2s2h/resource/type/Skeleton.h +++ b/mm/2s2h/resource/type/Skeleton.h @@ -5,7 +5,7 @@ #include "SkeletonLimb.h" #include -namespace LUS { +namespace SOH { enum class SkeletonType { Normal, @@ -50,11 +50,11 @@ union SkeletonData { SkelCurveLimbList skelCurveLimbList; }; -class Skeleton : public Resource { +class Skeleton : public LUS::Resource { public: using Resource::Resource; - Skeleton() : Resource(std::shared_ptr()) {} + Skeleton() : Resource(std::shared_ptr()) {} SkeletonData* GetPointer(); size_t GetPointerSize(); @@ -91,4 +91,4 @@ class SkeletonPatcher { }; -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/SkeletonLimb.cpp b/mm/2s2h/resource/type/SkeletonLimb.cpp index 8e5a8ef6d..eb599e641 100644 --- a/mm/2s2h/resource/type/SkeletonLimb.cpp +++ b/mm/2s2h/resource/type/SkeletonLimb.cpp @@ -1,6 +1,6 @@ #include "SkeletonLimb.h" -namespace LUS { +namespace SOH { SkeletonLimbData* SkeletonLimb::GetPointer() { return &limbData; } @@ -21,4 +21,4 @@ size_t SkeletonLimb::GetPointerSize() { return 0; } } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/SkeletonLimb.h b/mm/2s2h/resource/type/SkeletonLimb.h index 2110b3484..c93eb1897 100644 --- a/mm/2s2h/resource/type/SkeletonLimb.h +++ b/mm/2s2h/resource/type/SkeletonLimb.h @@ -4,7 +4,7 @@ #include "libultraship/libultra.h" #include "z64math.h" -namespace LUS { +namespace SOH { enum class LimbType { Invalid, Standard, @@ -97,11 +97,12 @@ union SkeletonLimbData { SkinLimb skinLimb; }; -class SkeletonLimb : public Resource { +class SkeletonLimb : public LUS::Resource { public: using Resource::Resource; - SkeletonLimb() : Resource(std::shared_ptr()) {} + SkeletonLimb() : Resource(std::shared_ptr()) { + } SkeletonLimbData* GetPointer(); size_t GetPointerSize(); @@ -131,4 +132,4 @@ public: std::vector> skinLimbModifVertexArrays; std::vector> skinLimbModifTransformationArrays; }; -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/Text.cpp b/mm/2s2h/resource/type/Text.cpp deleted file mode 100644 index eee289f8a..000000000 --- a/mm/2s2h/resource/type/Text.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "Text.h" - -namespace LUS { -MessageEntry* Text::GetPointer() { - return messages.data(); -} - -size_t Text::GetPointerSize() { - return messages.size() * sizeof(MessageEntry); -} -} // namespace LUS diff --git a/mm/2s2h/resource/type/Text.h b/mm/2s2h/resource/type/Text.h deleted file mode 100644 index db0cb36a0..000000000 --- a/mm/2s2h/resource/type/Text.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include -#include -#include "Resource.h" -#include - -namespace LUS { -// TODO: we've moved away from using classes for this stuff -class MessageEntry -{ -public: - uint16_t id; - uint8_t textboxType; - uint8_t textboxYPos; - std::string msg; -}; - -class Text : public Resource { -public: - using Resource::Resource; - - Text() : Resource(std::shared_ptr()) {} - - MessageEntry* GetPointer(); - size_t GetPointerSize(); - - std::vector messages; -}; -}; // namespace LUS diff --git a/mm/2s2h/resource/type/TextMM.cpp b/mm/2s2h/resource/type/TextMM.cpp index b4acc8d18..18f910044 100644 --- a/mm/2s2h/resource/type/TextMM.cpp +++ b/mm/2s2h/resource/type/TextMM.cpp @@ -1,6 +1,6 @@ #include "TextMM.h" -namespace LUS { +namespace SOH { MessageEntryMM* TextMM::GetPointer() { return messages.data(); } @@ -8,4 +8,4 @@ MessageEntryMM* TextMM::GetPointer() { size_t TextMM::GetPointerSize() { return messages.size() * sizeof(MessageEntryMM); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/TextMM.h b/mm/2s2h/resource/type/TextMM.h index 7a6e2d1ab..812452e42 100644 --- a/mm/2s2h/resource/type/TextMM.h +++ b/mm/2s2h/resource/type/TextMM.h @@ -5,7 +5,7 @@ #include "Resource.h" #include -namespace LUS { +namespace SOH { // TODO: we've moved away from using classes for this stuff class MessageEntryMM { @@ -22,11 +22,11 @@ class MessageEntryMM { std::string msg; }; -class TextMM : public Resource { +class TextMM : public LUS::Resource { public: using Resource::Resource; - TextMM() : Resource(std::shared_ptr()) { + TextMM() : Resource(std::shared_ptr()) { } MessageEntryMM* GetPointer(); @@ -34,4 +34,4 @@ public: std::vector messages; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/TextureAnimation.cpp b/mm/2s2h/resource/type/TextureAnimation.cpp index 0d49d0e5b..3dffe4b76 100644 --- a/mm/2s2h/resource/type/TextureAnimation.cpp +++ b/mm/2s2h/resource/type/TextureAnimation.cpp @@ -1,6 +1,6 @@ #include "TextureAnimation.h" -namespace LUS { +namespace SOH { TextureAnimation::~TextureAnimation() { for (auto& a : anims) { switch ((TextureAnimationParamsType)a.type) { @@ -33,4 +33,4 @@ AnimatedMaterial* TextureAnimation::GetPointer() { size_t TextureAnimation::GetPointerSize() { return anims.size() * sizeof(AnimatedMaterial); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/TextureAnimation.h b/mm/2s2h/resource/type/TextureAnimation.h index 843599c48..e41286d94 100644 --- a/mm/2s2h/resource/type/TextureAnimation.h +++ b/mm/2s2h/resource/type/TextureAnimation.h @@ -1,7 +1,7 @@ #pragma once #include "Resource.h" -namespace LUS { +namespace SOH { enum class TextureAnimationParamsType { /* 0 */ SingleScroll, /* 1 */ DualScroll, @@ -88,12 +88,12 @@ typedef struct { /* 0x4 */ void* params; } AnimatedMaterial; // size = 0x8 -class TextureAnimation : public Resource { +class TextureAnimation : public LUS::Resource { public: using Resource::Resource; ~TextureAnimation(); - TextureAnimation() : Resource(std::shared_ptr()) { + TextureAnimation() : Resource(std::shared_ptr()) { } AnimatedMaterial* GetPointer(); @@ -102,4 +102,4 @@ class TextureAnimation : public Resource { std::vector anims; std::vector textureCycleTextures; }; -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/scenecommand/EndMarker.cpp b/mm/2s2h/resource/type/scenecommand/EndMarker.cpp index 9d12c1518..ba8898187 100644 --- a/mm/2s2h/resource/type/scenecommand/EndMarker.cpp +++ b/mm/2s2h/resource/type/scenecommand/EndMarker.cpp @@ -1,6 +1,6 @@ #include "EndMarker.h" -namespace LUS { +namespace SOH { Marker* EndMarker::GetPointer() { return &endMarker; } @@ -8,4 +8,4 @@ Marker* EndMarker::GetPointer() { size_t EndMarker::GetPointerSize() { return sizeof(Marker); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/EndMarker.h b/mm/2s2h/resource/type/scenecommand/EndMarker.h index 9f981f1f9..34df38963 100644 --- a/mm/2s2h/resource/type/scenecommand/EndMarker.h +++ b/mm/2s2h/resource/type/scenecommand/EndMarker.h @@ -1,13 +1,11 @@ #pragma once #include -#include -#include #include "Resource.h" #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { } Marker; @@ -21,4 +19,4 @@ class EndMarker : public SceneCommand { Marker endMarker; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/RomFile.h b/mm/2s2h/resource/type/scenecommand/RomFile.h index ebdc3dc3b..19a5545e7 100644 --- a/mm/2s2h/resource/type/scenecommand/RomFile.h +++ b/mm/2s2h/resource/type/scenecommand/RomFile.h @@ -2,7 +2,7 @@ #include -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ uintptr_t vromStart; /* 0x04 */ uintptr_t vromEnd; diff --git a/mm/2s2h/resource/type/scenecommand/SceneCommand.h b/mm/2s2h/resource/type/scenecommand/SceneCommand.h index ea99e066e..c6d0d9424 100644 --- a/mm/2s2h/resource/type/scenecommand/SceneCommand.h +++ b/mm/2s2h/resource/type/scenecommand/SceneCommand.h @@ -6,7 +6,7 @@ #include "Resource.h" #include -namespace LUS { +namespace SOH { enum class SceneCommandID : uint8_t { SetStartPositionList = 0x00, @@ -48,10 +48,10 @@ enum class SceneCommandID : uint8_t { Error = 0xFF }; -class ISceneCommand : public IResource { +class ISceneCommand : public LUS::IResource { public: using IResource::IResource; - ISceneCommand() : IResource(std::shared_ptr()) {} + ISceneCommand() : IResource(std::shared_ptr()) {} SceneCommandID cmdId; }; @@ -64,4 +64,4 @@ template class SceneCommand : public ISceneCommand { } }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetActorCutsceneList.cpp b/mm/2s2h/resource/type/scenecommand/SetActorCutsceneList.cpp index 79d5253ac..735562ce8 100644 --- a/mm/2s2h/resource/type/scenecommand/SetActorCutsceneList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetActorCutsceneList.cpp @@ -1,7 +1,7 @@ #include "SetActorCutsceneList.h" #include "2s2h/resource/type/scenecommand/SetActorCutsceneList.h" -namespace LUS { +namespace SOH { CutsceneEntry* SetActorCutsceneList::GetPointer() { return entries.data(); } @@ -10,4 +10,4 @@ size_t SetActorCutsceneList::GetPointerSize() { return entries.size() * sizeof(CutsceneEntry); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/scenecommand/SetActorCutsceneList.h b/mm/2s2h/resource/type/scenecommand/SetActorCutsceneList.h index 5b93d1a5b..f9989bd53 100644 --- a/mm/2s2h/resource/type/scenecommand/SetActorCutsceneList.h +++ b/mm/2s2h/resource/type/scenecommand/SetActorCutsceneList.h @@ -3,7 +3,7 @@ #include "Resource.h" #include "SceneCommand.h" -namespace LUS { +namespace SOH { typedef struct CutsceneEntry { int16_t priority; int16_t length; @@ -24,7 +24,6 @@ class SetActorCutsceneList : public SceneCommand { CutsceneEntry* GetPointer(); size_t GetPointerSize(); - uint32_t numEntries; std::vector entries; }; diff --git a/mm/2s2h/resource/type/scenecommand/SetActorList.cpp b/mm/2s2h/resource/type/scenecommand/SetActorList.cpp index d37ebb148..5bb62e764 100644 --- a/mm/2s2h/resource/type/scenecommand/SetActorList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetActorList.cpp @@ -1,6 +1,6 @@ #include "SetActorList.h" -namespace LUS { +namespace SOH { ActorEntry* SetActorList::GetPointer() { return actorList.data(); } @@ -8,4 +8,4 @@ ActorEntry* SetActorList::GetPointer() { size_t SetActorList::GetPointerSize() { return actorList.size() * sizeof(ActorEntry); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetActorList.h b/mm/2s2h/resource/type/scenecommand/SetActorList.h index 117175d7d..5da281b7e 100644 --- a/mm/2s2h/resource/type/scenecommand/SetActorList.h +++ b/mm/2s2h/resource/type/scenecommand/SetActorList.h @@ -2,14 +2,11 @@ #include #include -#include -#include #include "Resource.h" #include "SceneCommand.h" -// #include #include "z64math.h" -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ s16 id; /* 0x02 */ Vec3s pos; @@ -27,4 +24,4 @@ class SetActorList : public SceneCommand { uint32_t numActors; std::vector actorList; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetAlternateHeaders.cpp b/mm/2s2h/resource/type/scenecommand/SetAlternateHeaders.cpp index 15b3c97d4..911fef455 100644 --- a/mm/2s2h/resource/type/scenecommand/SetAlternateHeaders.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetAlternateHeaders.cpp @@ -1,6 +1,6 @@ #include "SetAlternateHeaders.h" -namespace LUS { +namespace SOH { void* SetAlternateHeaders::GetPointer() { // Like Scene, SetAlternateHeader is a special type that is only acted upon in C++. return nullptr; @@ -9,4 +9,4 @@ void* SetAlternateHeaders::GetPointer() { size_t SetAlternateHeaders::GetPointerSize() { return 0; } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetAlternateHeaders.h b/mm/2s2h/resource/type/scenecommand/SetAlternateHeaders.h index ebc571e3d..0e0b78747 100644 --- a/mm/2s2h/resource/type/scenecommand/SetAlternateHeaders.h +++ b/mm/2s2h/resource/type/scenecommand/SetAlternateHeaders.h @@ -2,8 +2,6 @@ #include #include -#include -#include #include "Resource.h" #include "SceneCommand.h" #include "2s2h/resource/type/Scene.h" @@ -11,8 +9,7 @@ #include -namespace LUS { - +namespace SOH { class SetAlternateHeaders : public SceneCommand { public: using SceneCommand::SceneCommand; @@ -23,4 +20,4 @@ class SetAlternateHeaders : public SceneCommand { uint32_t numHeaders; std::vector> headers; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetAnimatedMaterialList.cpp b/mm/2s2h/resource/type/scenecommand/SetAnimatedMaterialList.cpp index ef3adc543..8ac5483b4 100644 --- a/mm/2s2h/resource/type/scenecommand/SetAnimatedMaterialList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetAnimatedMaterialList.cpp @@ -1,13 +1,13 @@ #include "SetAnimatedMaterialList.h" -namespace LUS { +namespace SOH { -AnimatedMaterialData* LUS::SetAnimatedMaterialList::GetPointer() { +AnimatedMaterial* SetAnimatedMaterialList::GetPointer() { return mat; } -size_t LUS::SetAnimatedMaterialList::GetPointerSize() { - return sizeof(AnimatedMaterialData); +size_t SetAnimatedMaterialList::GetPointerSize() { + return sizeof(AnimatedMaterial); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/scenecommand/SetAnimatedMaterialList.h b/mm/2s2h/resource/type/scenecommand/SetAnimatedMaterialList.h index 02a8c7c38..4ba5363c6 100644 --- a/mm/2s2h/resource/type/scenecommand/SetAnimatedMaterialList.h +++ b/mm/2s2h/resource/type/scenecommand/SetAnimatedMaterialList.h @@ -3,21 +3,22 @@ #include "Resource.h" #include "SceneCommand.h" #include +#include "2s2h/resource/type/TextureAnimation.h" -namespace LUS { +namespace SOH { typedef struct { /* 0x0 */ int8_t segment; /* 0x2 */ int16_t type; /* 0x4 */ void* params; } AnimatedMaterialData; // size = 0x8 -class SetAnimatedMaterialList : public SceneCommand { +class SetAnimatedMaterialList : public SceneCommand { public: using SceneCommand::SceneCommand; - AnimatedMaterialData* GetPointer(); + AnimatedMaterial* GetPointer(); size_t GetPointerSize(); - AnimatedMaterialData* mat; + AnimatedMaterial* mat; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetCameraSettings.cpp b/mm/2s2h/resource/type/scenecommand/SetCameraSettings.cpp index e1d2967e7..5c41f1c8f 100644 --- a/mm/2s2h/resource/type/scenecommand/SetCameraSettings.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetCameraSettings.cpp @@ -1,6 +1,6 @@ #include "SetCameraSettings.h" -namespace LUS { +namespace SOH { CameraSettings* SetCameraSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ CameraSettings* SetCameraSettings::GetPointer() { size_t SetCameraSettings::GetPointerSize() { return sizeof(CameraSettings); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetCameraSettings.h b/mm/2s2h/resource/type/scenecommand/SetCameraSettings.h index adbde2e02..6bce30a9b 100644 --- a/mm/2s2h/resource/type/scenecommand/SetCameraSettings.h +++ b/mm/2s2h/resource/type/scenecommand/SetCameraSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { int8_t cameraMovement; int32_t worldMapArea; @@ -22,4 +22,4 @@ class SetCameraSettings : public SceneCommand { CameraSettings settings; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetCollisionHeader.cpp b/mm/2s2h/resource/type/scenecommand/SetCollisionHeader.cpp index db8cdcb32..a1c22b9ea 100644 --- a/mm/2s2h/resource/type/scenecommand/SetCollisionHeader.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetCollisionHeader.cpp @@ -1,6 +1,6 @@ #include "SetCollisionHeader.h" -namespace LUS { +namespace SOH { CollisionHeaderData* SetCollisionHeader::GetPointer() { if (collisionHeader == nullptr) { return nullptr; @@ -14,4 +14,4 @@ size_t SetCollisionHeader::GetPointerSize() { } return collisionHeader->GetPointerSize(); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetCollisionHeader.h b/mm/2s2h/resource/type/scenecommand/SetCollisionHeader.h index c615eedad..27dc65b53 100644 --- a/mm/2s2h/resource/type/scenecommand/SetCollisionHeader.h +++ b/mm/2s2h/resource/type/scenecommand/SetCollisionHeader.h @@ -1,15 +1,13 @@ #pragma once #include -#include #include #include #include "Resource.h" #include "2s2h/resource/type/scenecommand/SceneCommand.h" #include "2s2h/resource/type/CollisionHeader.h" -// #include -namespace LUS { +namespace SOH { class SetCollisionHeader : public SceneCommand { public: using SceneCommand::SceneCommand; @@ -21,4 +19,4 @@ class SetCollisionHeader : public SceneCommand { std::shared_ptr collisionHeader; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetCsCamera.cpp b/mm/2s2h/resource/type/scenecommand/SetCsCamera.cpp index 59af0c0fe..3614377fe 100644 --- a/mm/2s2h/resource/type/scenecommand/SetCsCamera.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetCsCamera.cpp @@ -1,6 +1,6 @@ #include "SetCsCamera.h" -namespace LUS { +namespace SOH { SetCsCamera::~SetCsCamera() { for (auto c : csCamera) { if (c.actorCsCamFuncData != nullptr) { @@ -15,4 +15,4 @@ ActorCsCamInfoData* SetCsCamera::GetPointer() { size_t SetCsCamera::GetPointerSize() { return sizeof(ActorCsCamInfoData); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetCsCamera.h b/mm/2s2h/resource/type/scenecommand/SetCsCamera.h index fa5d9a500..406b7fa93 100644 --- a/mm/2s2h/resource/type/scenecommand/SetCsCamera.h +++ b/mm/2s2h/resource/type/scenecommand/SetCsCamera.h @@ -2,16 +2,11 @@ #include #include -#include #include "Resource.h" #include "SceneCommand.h" #include -namespace LUS { -typedef struct { - -} CsCamera; - +namespace SOH { typedef struct { /* 0x0 */ s16 x; /* 0x2 */ s16 y; @@ -34,4 +29,4 @@ class SetCsCamera : public SceneCommand { std::vector csCamera; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetCutscenes.cpp b/mm/2s2h/resource/type/scenecommand/SetCutscenes.cpp index 51ceca4be..f84a8f5b6 100644 --- a/mm/2s2h/resource/type/scenecommand/SetCutscenes.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetCutscenes.cpp @@ -1,20 +1,6 @@ #include "SetCutscenes.h" -namespace LUS { -uint32_t* SetCutscenes::GetPointer() { - if (cutscene == nullptr) { - return nullptr; - } - return cutscene->GetPointer(); -} - -size_t SetCutscenes::GetPointerSize() { - if (cutscene == nullptr) { - return 0; - } - return cutscene->GetPointerSize(); -} - +namespace SOH { CutsceneScriptEntry* SetCutscenesMM::GetPointer() { if (entries.size() == 0) { return nullptr; @@ -29,4 +15,4 @@ size_t SetCutscenesMM::GetPointerSize() { return entries.size() * sizeof(CutsceneScriptEntry); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetCutscenes.h b/mm/2s2h/resource/type/scenecommand/SetCutscenes.h index 900201522..6fe2a838c 100644 --- a/mm/2s2h/resource/type/scenecommand/SetCutscenes.h +++ b/mm/2s2h/resource/type/scenecommand/SetCutscenes.h @@ -2,25 +2,11 @@ #include #include -#include -#include #include "Resource.h" #include "2s2h/resource/type/scenecommand/SceneCommand.h" #include "2s2h/resource/type/Cutscene.h" -// #include - -namespace LUS { -class SetCutscenes : public SceneCommand { - public: - using SceneCommand::SceneCommand; - - uint32_t* GetPointer(); - size_t GetPointerSize(); - - std::string fileName; - std::shared_ptr cutscene; -}; +namespace SOH { class CutsceneScriptEntry { public: void* data; @@ -29,7 +15,6 @@ class CutsceneScriptEntry { uint8_t flag; }; - class SetCutscenesMM : public SceneCommand { public: using SceneCommand::SceneCommand; @@ -40,4 +25,4 @@ class SetCutscenesMM : public SceneCommand { std::vector entries; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetEchoSettings.cpp b/mm/2s2h/resource/type/scenecommand/SetEchoSettings.cpp index 47cfa85ad..d4b2b1e15 100644 --- a/mm/2s2h/resource/type/scenecommand/SetEchoSettings.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetEchoSettings.cpp @@ -1,6 +1,6 @@ #include "SetEchoSettings.h" -namespace LUS { +namespace SOH { EchoSettings* SetEchoSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ EchoSettings* SetEchoSettings::GetPointer() { size_t SetEchoSettings::GetPointerSize() { return sizeof(EchoSettings); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetEchoSettings.h b/mm/2s2h/resource/type/scenecommand/SetEchoSettings.h index ea2f664d4..12c2036c9 100644 --- a/mm/2s2h/resource/type/scenecommand/SetEchoSettings.h +++ b/mm/2s2h/resource/type/scenecommand/SetEchoSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { int8_t echo; } EchoSettings; @@ -21,4 +21,4 @@ class SetEchoSettings : public SceneCommand { EchoSettings settings; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetEntranceList.cpp b/mm/2s2h/resource/type/scenecommand/SetEntranceList.cpp index d33ac189b..e82711da2 100644 --- a/mm/2s2h/resource/type/scenecommand/SetEntranceList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetEntranceList.cpp @@ -1,6 +1,6 @@ #include "SetEntranceList.h" -namespace LUS { +namespace SOH { EntranceEntry* SetEntranceList::GetPointer() { return entrances.data(); } @@ -8,4 +8,4 @@ EntranceEntry* SetEntranceList::GetPointer() { size_t SetEntranceList::GetPointerSize() { return entrances.size() * sizeof(EntranceEntry); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetEntranceList.h b/mm/2s2h/resource/type/scenecommand/SetEntranceList.h index d31dda78c..ed6084f55 100644 --- a/mm/2s2h/resource/type/scenecommand/SetEntranceList.h +++ b/mm/2s2h/resource/type/scenecommand/SetEntranceList.h @@ -2,13 +2,12 @@ #include #include -#include #include #include "Resource.h" #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ u8 spawn; /* 0x01 */ u8 room; @@ -25,4 +24,4 @@ class SetEntranceList : public SceneCommand { std::vector entrances; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetExitList.cpp b/mm/2s2h/resource/type/scenecommand/SetExitList.cpp index 99966cdb4..3de483b0e 100644 --- a/mm/2s2h/resource/type/scenecommand/SetExitList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetExitList.cpp @@ -1,6 +1,6 @@ #include "SetExitList.h" -namespace LUS { +namespace SOH { uint16_t* SetExitList::GetPointer() { return exits.data(); } @@ -8,4 +8,4 @@ uint16_t* SetExitList::GetPointer() { size_t SetExitList::GetPointerSize() { return exits.size() * sizeof(int16_t); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetExitList.h b/mm/2s2h/resource/type/scenecommand/SetExitList.h index c6f0b3f42..56026075f 100644 --- a/mm/2s2h/resource/type/scenecommand/SetExitList.h +++ b/mm/2s2h/resource/type/scenecommand/SetExitList.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { class SetExitList : public SceneCommand { public: using SceneCommand::SceneCommand; @@ -19,4 +19,4 @@ class SetExitList : public SceneCommand { std::vector exits; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetLightList.cpp b/mm/2s2h/resource/type/scenecommand/SetLightList.cpp index c59f75c20..459e957cb 100644 --- a/mm/2s2h/resource/type/scenecommand/SetLightList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetLightList.cpp @@ -1,6 +1,6 @@ #include "SetLightList.h" -namespace LUS { +namespace SOH { LightInfo* SetLightList::GetPointer() { return lightList.data(); } @@ -8,4 +8,4 @@ LightInfo* SetLightList::GetPointer() { size_t SetLightList::GetPointerSize() { return lightList.size() * sizeof(LightInfo); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetLightList.h b/mm/2s2h/resource/type/scenecommand/SetLightList.h index bbc5aad3d..5e07d8fb5 100644 --- a/mm/2s2h/resource/type/scenecommand/SetLightList.h +++ b/mm/2s2h/resource/type/scenecommand/SetLightList.h @@ -2,13 +2,11 @@ #include #include -#include -#include #include "Resource.h" #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { /* 0x0 */ s16 x; /* 0x2 */ s16 y; @@ -45,4 +43,4 @@ class SetLightList : public SceneCommand { uint32_t numLights; std::vector lightList; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetLightingSettings.cpp b/mm/2s2h/resource/type/scenecommand/SetLightingSettings.cpp index 69127f19c..042062512 100644 --- a/mm/2s2h/resource/type/scenecommand/SetLightingSettings.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetLightingSettings.cpp @@ -1,6 +1,6 @@ #include "SetLightingSettings.h" -namespace LUS { +namespace SOH { EnvLightSettings* SetLightingSettings::GetPointer() { return settings.data(); } @@ -8,4 +8,4 @@ EnvLightSettings* SetLightingSettings::GetPointer() { size_t SetLightingSettings::GetPointerSize() { return settings.size() * sizeof(EnvLightSettings); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetLightingSettings.h b/mm/2s2h/resource/type/scenecommand/SetLightingSettings.h index ca894fec3..c4059d259 100644 --- a/mm/2s2h/resource/type/scenecommand/SetLightingSettings.h +++ b/mm/2s2h/resource/type/scenecommand/SetLightingSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ u8 ambientColor[3]; /* 0x03 */ s8 light1Dir[3]; @@ -28,4 +28,4 @@ class SetLightingSettings : public SceneCommand { std::vector settings; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetMesh.cpp b/mm/2s2h/resource/type/scenecommand/SetMesh.cpp index 5ecd2cbfa..1e2cd396c 100644 --- a/mm/2s2h/resource/type/scenecommand/SetMesh.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetMesh.cpp @@ -1,6 +1,6 @@ #include "SetMesh.h" -namespace LUS { +namespace SOH { MeshHeader* SetMesh::GetPointer() { return &meshHeader; } @@ -8,4 +8,4 @@ MeshHeader* SetMesh::GetPointer() { size_t SetMesh::GetPointerSize() { return sizeof(MeshHeader); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetMesh.h b/mm/2s2h/resource/type/scenecommand/SetMesh.h index a3a6c9731..37684b7e1 100644 --- a/mm/2s2h/resource/type/scenecommand/SetMesh.h +++ b/mm/2s2h/resource/type/scenecommand/SetMesh.h @@ -2,13 +2,12 @@ #include #include -#include #include "Resource.h" #include "SceneCommand.h" #include "libultraship/libultra.h" #include "z64math.h" -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ u8 type; } PolygonBase; @@ -100,4 +99,4 @@ class SetMesh : public SceneCommand { std::vector images; MeshHeader meshHeader; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetMinimapChests.cpp b/mm/2s2h/resource/type/scenecommand/SetMinimapChests.cpp index dde6da61d..ec45f32ce 100644 --- a/mm/2s2h/resource/type/scenecommand/SetMinimapChests.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetMinimapChests.cpp @@ -1,6 +1,6 @@ #include "SetMinimapChests.h" -namespace LUS { +namespace SOH { MinimapChestData* SetMinimapChests::GetPointer() { return chests.data(); @@ -10,4 +10,4 @@ size_t SetMinimapChests::GetPointerSize() { return sizeof(MinimapChestData); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/scenecommand/SetMinimapChests.h b/mm/2s2h/resource/type/scenecommand/SetMinimapChests.h index 2877d4dc7..e99ef2634 100644 --- a/mm/2s2h/resource/type/scenecommand/SetMinimapChests.h +++ b/mm/2s2h/resource/type/scenecommand/SetMinimapChests.h @@ -2,7 +2,7 @@ #include "Resource.h" #include "SceneCommand.h" -namespace LUS { +namespace SOH { typedef struct { int16_t unk_0; int16_t unk_2; diff --git a/mm/2s2h/resource/type/scenecommand/SetMinimapList.cpp b/mm/2s2h/resource/type/scenecommand/SetMinimapList.cpp index e97a6eee0..270d22e98 100644 --- a/mm/2s2h/resource/type/scenecommand/SetMinimapList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetMinimapList.cpp @@ -1,13 +1,13 @@ #include "SetMinimapList.h" -namespace LUS { +namespace SOH { -MinimapListData* LUS::SetMinimapList::GetPointer() { +MinimapListData* SetMinimapList::GetPointer() { return &list; } -size_t LUS::SetMinimapList::GetPointerSize() { +size_t SetMinimapList::GetPointerSize() { return sizeof(list); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/mm/2s2h/resource/type/scenecommand/SetMinimapList.h b/mm/2s2h/resource/type/scenecommand/SetMinimapList.h index ecebbc323..48eaa8902 100644 --- a/mm/2s2h/resource/type/scenecommand/SetMinimapList.h +++ b/mm/2s2h/resource/type/scenecommand/SetMinimapList.h @@ -4,8 +4,7 @@ #include "SceneCommand.h" #include - -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ u16 mapId; /* 0x02 */ s16 unk2; diff --git a/mm/2s2h/resource/type/scenecommand/SetObjectList.cpp b/mm/2s2h/resource/type/scenecommand/SetObjectList.cpp index 921166675..04aeb27d0 100644 --- a/mm/2s2h/resource/type/scenecommand/SetObjectList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetObjectList.cpp @@ -1,6 +1,6 @@ #include "SetObjectList.h" -namespace LUS { +namespace SOH { int16_t* SetObjectList::GetPointer() { return objects.data(); } @@ -8,4 +8,4 @@ int16_t* SetObjectList::GetPointer() { size_t SetObjectList::GetPointerSize() { return objects.size() * sizeof(int16_t); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetObjectList.h b/mm/2s2h/resource/type/scenecommand/SetObjectList.h index c6f786636..a3042ba5d 100644 --- a/mm/2s2h/resource/type/scenecommand/SetObjectList.h +++ b/mm/2s2h/resource/type/scenecommand/SetObjectList.h @@ -2,13 +2,11 @@ #include #include -#include -#include #include "Resource.h" #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { class SetObjectList : public SceneCommand { public: using SceneCommand::SceneCommand; @@ -19,4 +17,4 @@ class SetObjectList : public SceneCommand { uint32_t numObjects; std::vector objects; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetPathways.cpp b/mm/2s2h/resource/type/scenecommand/SetPathways.cpp index 046543a5b..6cd1c35e4 100644 --- a/mm/2s2h/resource/type/scenecommand/SetPathways.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetPathways.cpp @@ -1,18 +1,10 @@ #include "SetPathways.h" -namespace LUS { -PathData** SetPathways::GetPointer() { - return paths.data(); -} - -size_t SetPathways::GetPointerSize() { - return paths.size() * sizeof(PathData*); -} - +namespace SOH { PathDataMM** SetPathwaysMM::GetPointer() { return paths.data(); } size_t SetPathwaysMM::GetPointerSize() { - return paths.size() * sizeof(PathData*); + return paths.size() * sizeof(PathDataMM*); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetPathways.h b/mm/2s2h/resource/type/scenecommand/SetPathways.h index e72cdcb29..e43eaba61 100644 --- a/mm/2s2h/resource/type/scenecommand/SetPathways.h +++ b/mm/2s2h/resource/type/scenecommand/SetPathways.h @@ -2,25 +2,11 @@ #include #include -#include #include "Resource.h" #include "SceneCommand.h" -// #include #include "2s2h/resource/type/Path.h" -namespace LUS { - -class SetPathways : public SceneCommand { - public: - using SceneCommand::SceneCommand; - - PathData** GetPointer(); - size_t GetPointerSize(); - - uint32_t numPaths; - std::vector paths; -}; - +namespace SOH { class SetPathwaysMM : public SceneCommand { public: using SceneCommand::SceneCommand; @@ -32,4 +18,4 @@ class SetPathwaysMM : public SceneCommand { std::vector paths; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetRoomBehavior.cpp b/mm/2s2h/resource/type/scenecommand/SetRoomBehavior.cpp index a56562449..cfacd61b0 100644 --- a/mm/2s2h/resource/type/scenecommand/SetRoomBehavior.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetRoomBehavior.cpp @@ -1,17 +1,10 @@ #include "SetRoomBehavior.h" -namespace LUS { -RoomBehavior* SetRoomBehavior::GetPointer() { - return &roomBehavior; -} - -size_t SetRoomBehavior::GetPointerSize() { - return sizeof(RoomBehavior); -} +namespace SOH { RoomBehaviorMM* SetRoomBehaviorMM::GetPointer() { return &roomBehavior; } size_t SetRoomBehaviorMM::GetPointerSize() { return sizeof(RoomBehaviorMM); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetRoomBehavior.h b/mm/2s2h/resource/type/scenecommand/SetRoomBehavior.h index 6889a2aee..94fa8a2bd 100644 --- a/mm/2s2h/resource/type/scenecommand/SetRoomBehavior.h +++ b/mm/2s2h/resource/type/scenecommand/SetRoomBehavior.h @@ -7,12 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { -typedef struct { - int8_t gameplayFlags; - int32_t gameplayFlags2; -} RoomBehavior; - +namespace SOH { typedef struct { int8_t gameplayFlags; int8_t currRoomUnk2; @@ -22,17 +17,6 @@ typedef struct { int8_t kankyoContextUnkE2; } RoomBehaviorMM; -class SetRoomBehavior : public SceneCommand { - public: - using SceneCommand::SceneCommand; - - RoomBehavior* GetPointer(); - size_t GetPointerSize(); - - RoomBehavior roomBehavior; -}; - - class SetRoomBehaviorMM : public SceneCommand { public: using SceneCommand::SceneCommand; @@ -43,4 +27,4 @@ class SetRoomBehaviorMM : public SceneCommand { RoomBehaviorMM roomBehavior; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetRoomList.cpp b/mm/2s2h/resource/type/scenecommand/SetRoomList.cpp index cf8c1d61a..c81d3645e 100644 --- a/mm/2s2h/resource/type/scenecommand/SetRoomList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetRoomList.cpp @@ -1,6 +1,6 @@ #include "SetRoomList.h" -namespace LUS { +namespace SOH { RomFile* SetRoomList::GetPointer() { return rooms.data(); } @@ -8,4 +8,4 @@ RomFile* SetRoomList::GetPointer() { size_t SetRoomList::GetPointerSize() { return rooms.size() * sizeof(RomFile); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetRoomList.h b/mm/2s2h/resource/type/scenecommand/SetRoomList.h index 9bd0e07bc..3fa4a034c 100644 --- a/mm/2s2h/resource/type/scenecommand/SetRoomList.h +++ b/mm/2s2h/resource/type/scenecommand/SetRoomList.h @@ -2,7 +2,6 @@ #include #include -#include #include #include "Resource.h" #include "SceneCommand.h" @@ -10,13 +9,7 @@ #include #include -namespace LUS { -// typedef struct { -// /* 0x00 */ uintptr_t vromStart; -// /* 0x04 */ uintptr_t vromEnd; -// char* fileName; -// } RomFile; // size = 0x8 - +namespace SOH { class SetRoomList : public SceneCommand { public: using SceneCommand::SceneCommand; @@ -28,8 +21,5 @@ class SetRoomList : public SceneCommand { std::vector fileNames; std::vector rooms; - ~SetRoomList() { - SPDLOG_TRACE("ROOM LIST DTOR"); - } }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetSkyboxModifier.cpp b/mm/2s2h/resource/type/scenecommand/SetSkyboxModifier.cpp index 9926ec01a..122d93d77 100644 --- a/mm/2s2h/resource/type/scenecommand/SetSkyboxModifier.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetSkyboxModifier.cpp @@ -1,6 +1,6 @@ #include "SetSkyboxModifier.h" -namespace LUS { +namespace SOH { SkyboxModifier* SetSkyboxModifier::GetPointer() { return &modifier; } @@ -8,4 +8,4 @@ SkyboxModifier* SetSkyboxModifier::GetPointer() { size_t SetSkyboxModifier::GetPointerSize() { return sizeof(SkyboxModifier); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetSkyboxModifier.h b/mm/2s2h/resource/type/scenecommand/SetSkyboxModifier.h index 6a54879e6..6cb1ab19b 100644 --- a/mm/2s2h/resource/type/scenecommand/SetSkyboxModifier.h +++ b/mm/2s2h/resource/type/scenecommand/SetSkyboxModifier.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { uint8_t skyboxDisabled; uint8_t sunMoonDisabled; @@ -22,4 +22,4 @@ class SetSkyboxModifier : public SceneCommand { SkyboxModifier modifier; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetSkyboxSettings.cpp b/mm/2s2h/resource/type/scenecommand/SetSkyboxSettings.cpp index 7f12d4fa3..527f0462c 100644 --- a/mm/2s2h/resource/type/scenecommand/SetSkyboxSettings.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetSkyboxSettings.cpp @@ -1,6 +1,6 @@ #include "SetSkyboxSettings.h" -namespace LUS { +namespace SOH { SkyboxSettings* SetSkyboxSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ SkyboxSettings* SetSkyboxSettings::GetPointer() { size_t SetSkyboxSettings::GetPointerSize() { return sizeof(SetSkyboxSettings); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetSkyboxSettings.h b/mm/2s2h/resource/type/scenecommand/SetSkyboxSettings.h index a2a9593b0..30fef6b91 100644 --- a/mm/2s2h/resource/type/scenecommand/SetSkyboxSettings.h +++ b/mm/2s2h/resource/type/scenecommand/SetSkyboxSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { uint8_t unk; uint8_t skyboxId; @@ -24,4 +24,4 @@ class SetSkyboxSettings : public SceneCommand { SkyboxSettings settings; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetSoundSettings.cpp b/mm/2s2h/resource/type/scenecommand/SetSoundSettings.cpp index f6f1941d1..c136d34db 100644 --- a/mm/2s2h/resource/type/scenecommand/SetSoundSettings.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetSoundSettings.cpp @@ -1,6 +1,6 @@ #include "SetSoundSettings.h" -namespace LUS { +namespace SOH { SoundSettings* SetSoundSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ SoundSettings* SetSoundSettings::GetPointer() { size_t SetSoundSettings::GetPointerSize() { return sizeof(SoundSettings); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetSoundSettings.h b/mm/2s2h/resource/type/scenecommand/SetSoundSettings.h index c4ee4668d..237261f6a 100644 --- a/mm/2s2h/resource/type/scenecommand/SetSoundSettings.h +++ b/mm/2s2h/resource/type/scenecommand/SetSoundSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { uint8_t seqId; uint8_t natureAmbienceId; @@ -23,4 +23,4 @@ class SetSoundSettings : public SceneCommand { SoundSettings settings; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetSpecialObjects.cpp b/mm/2s2h/resource/type/scenecommand/SetSpecialObjects.cpp index 3887107da..304ab514c 100644 --- a/mm/2s2h/resource/type/scenecommand/SetSpecialObjects.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetSpecialObjects.cpp @@ -1,6 +1,6 @@ #include "SetSpecialObjects.h" -namespace LUS { +namespace SOH { SpecialObjects* SetSpecialObjects::GetPointer() { return &specialObjects; } @@ -8,4 +8,4 @@ SpecialObjects* SetSpecialObjects::GetPointer() { size_t SetSpecialObjects::GetPointerSize() { return sizeof(SpecialObjects); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetSpecialObjects.h b/mm/2s2h/resource/type/scenecommand/SetSpecialObjects.h index 78cfcd425..f0f643657 100644 --- a/mm/2s2h/resource/type/scenecommand/SetSpecialObjects.h +++ b/mm/2s2h/resource/type/scenecommand/SetSpecialObjects.h @@ -1,13 +1,11 @@ #pragma once #include -#include -#include #include "Resource.h" #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { int8_t elfMessage; int16_t globalObject; @@ -22,4 +20,4 @@ class SetSpecialObjects : public SceneCommand { SpecialObjects specialObjects; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetStartPositionList.cpp b/mm/2s2h/resource/type/scenecommand/SetStartPositionList.cpp index 89fb40049..5fa17b2a0 100644 --- a/mm/2s2h/resource/type/scenecommand/SetStartPositionList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetStartPositionList.cpp @@ -1,6 +1,6 @@ #include "SetStartPositionList.h" -namespace LUS { +namespace SOH { ActorEntry* SetStartPositionList::GetPointer() { return startPositions.data(); } @@ -8,4 +8,4 @@ ActorEntry* SetStartPositionList::GetPointer() { size_t SetStartPositionList::GetPointerSize() { return startPositions.size() * sizeof(ActorEntry); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetStartPositionList.h b/mm/2s2h/resource/type/scenecommand/SetStartPositionList.h index cc939aca0..ae5f32b4d 100644 --- a/mm/2s2h/resource/type/scenecommand/SetStartPositionList.h +++ b/mm/2s2h/resource/type/scenecommand/SetStartPositionList.h @@ -2,14 +2,11 @@ #include #include -#include -#include #include "Resource.h" #include "SceneCommand.h" #include "2s2h/resource/type/scenecommand/SetActorList.h" -// #include -namespace LUS { +namespace SOH { // typedef struct { // /* 0x00 */ s16 id; // /* 0x02 */ Vec3s pos; @@ -27,4 +24,4 @@ class SetStartPositionList : public SceneCommand { uint32_t numStartPositions; std::vector startPositions; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetTimeSettings.cpp b/mm/2s2h/resource/type/scenecommand/SetTimeSettings.cpp index 9a10fb022..c9380a0a0 100644 --- a/mm/2s2h/resource/type/scenecommand/SetTimeSettings.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetTimeSettings.cpp @@ -1,6 +1,6 @@ #include "SetTimeSettings.h" -namespace LUS { +namespace SOH { TimeSettings* SetTimeSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ TimeSettings* SetTimeSettings::GetPointer() { size_t SetTimeSettings::GetPointerSize() { return sizeof(TimeSettings); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetTimeSettings.h b/mm/2s2h/resource/type/scenecommand/SetTimeSettings.h index 637398652..44146fe3d 100644 --- a/mm/2s2h/resource/type/scenecommand/SetTimeSettings.h +++ b/mm/2s2h/resource/type/scenecommand/SetTimeSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { uint8_t hour; uint8_t minute; @@ -23,4 +23,4 @@ class SetTimeSettings : public SceneCommand { TimeSettings settings; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetTransitionActorList.cpp b/mm/2s2h/resource/type/scenecommand/SetTransitionActorList.cpp index 86387e682..c944e99f2 100644 --- a/mm/2s2h/resource/type/scenecommand/SetTransitionActorList.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetTransitionActorList.cpp @@ -1,6 +1,6 @@ #include "SetTransitionActorList.h" -namespace LUS { +namespace SOH { TransitionActorEntry* SetTransitionActorList::GetPointer() { return transitionActorList.data(); } @@ -8,4 +8,4 @@ TransitionActorEntry* SetTransitionActorList::GetPointer() { size_t SetTransitionActorList::GetPointerSize() { return transitionActorList.size() * sizeof(TransitionActorEntry); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetTransitionActorList.h b/mm/2s2h/resource/type/scenecommand/SetTransitionActorList.h index bb6fc2ac6..ab142e5e8 100644 --- a/mm/2s2h/resource/type/scenecommand/SetTransitionActorList.h +++ b/mm/2s2h/resource/type/scenecommand/SetTransitionActorList.h @@ -2,14 +2,11 @@ #include #include -#include -#include #include "Resource.h" #include "SceneCommand.h" -// #include #include "z64math.h" -namespace LUS { +namespace SOH { typedef struct { struct { s8 room; // Room to switch to @@ -31,4 +28,4 @@ class SetTransitionActorList : public SceneCommand { uint32_t numTransitionActors; std::vector transitionActorList; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetWindSettings.cpp b/mm/2s2h/resource/type/scenecommand/SetWindSettings.cpp index 3aa9ce7a6..64bc8ecc8 100644 --- a/mm/2s2h/resource/type/scenecommand/SetWindSettings.cpp +++ b/mm/2s2h/resource/type/scenecommand/SetWindSettings.cpp @@ -1,6 +1,6 @@ #include "SetWindSettings.h" -namespace LUS { +namespace SOH { WindSettings* SetWindSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ WindSettings* SetWindSettings::GetPointer() { size_t SetWindSettings::GetPointerSize() { return sizeof(WindSettings); } -} // namespace LUS +} // namespace SOH diff --git a/mm/2s2h/resource/type/scenecommand/SetWindSettings.h b/mm/2s2h/resource/type/scenecommand/SetWindSettings.h index e79b445ae..389f3f0d8 100644 --- a/mm/2s2h/resource/type/scenecommand/SetWindSettings.h +++ b/mm/2s2h/resource/type/scenecommand/SetWindSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { int8_t windWest; int8_t windVertical; @@ -24,4 +24,4 @@ class SetWindSettings : public SceneCommand { WindSettings settings; }; -}; // namespace LUS +}; // namespace SOH diff --git a/mm/2s2h/z_message_OTR.cpp b/mm/2s2h/z_message_OTR.cpp index 7614dfbb1..617c82d3d 100644 --- a/mm/2s2h/z_message_OTR.cpp +++ b/mm/2s2h/z_message_OTR.cpp @@ -5,13 +5,12 @@ #include "global.h" #include "2s2h/resource/type/TextMM.h" #include -#include //extern "C" MessageTableEntry* sNesMessageEntryTablePtr; //extern "C" MessageTableEntry* sStaffMessageEntryTablePtr; MessageTableEntry* OTRMessage_LoadTable(const char* filePath, bool isNES) { - auto file = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(filePath)); + auto file = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(filePath)); if (file == nullptr) return nullptr; @@ -62,7 +61,7 @@ extern "C" void OTRMessage_Init(PlayState* play) { //if (play->msgCtx.messageTableStaff == NULL) { auto file2 = - std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource( + std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource( "text/staff_message_data_static/staff_message_data_static")); // OTRTODO: Should not be malloc'ing here. It's fine for now since we check that the message table is already null. play->msgCtx.messageTableStaff = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file2->messages.size()); diff --git a/mm/2s2h/z_play_2SH.cpp b/mm/2s2h/z_play_2SH.cpp index 5cd2296c7..9f4437aa7 100644 --- a/mm/2s2h/z_play_2SH.cpp +++ b/mm/2s2h/z_play_2SH.cpp @@ -13,7 +13,7 @@ LUS::IResource* OTRPlay_LoadFile(PlayState* play, const char* fileName) { return res.get(); } -s32 OTRScene_ExecuteCommands(PlayState* play, LUS::Scene* scene); +s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene); extern "C" void OTRPlay_InitScene(PlayState* play, s32 spawn) { play->curSpawn = spawn; @@ -31,7 +31,7 @@ extern "C" void OTRPlay_InitScene(PlayState* play, s32 spawn) { Scene_ResetTransitionActorList(&play->state, &play->transitionActors); Room_Init(play, &play->roomCtx); gSaveContext.worldMapArea = 0; - OTRScene_ExecuteCommands(play, (LUS::Scene*)play->sceneSegment); + OTRScene_ExecuteCommands(play, (SOH::Scene*)play->sceneSegment); Play_InitEnvironment(play, play->skyboxId); } @@ -59,7 +59,7 @@ extern "C" s32 OTRfunc_800973FC(PlayState* play, RoomContext* roomCtx) { roomCtx->curRoom.segment = roomCtx->activeRoomVram; gSegments[3] = (uintptr_t)roomCtx->activeRoomVram; - OTRScene_ExecuteCommands(play, (LUS::Scene*)roomCtx->curRoom.segment); + OTRScene_ExecuteCommands(play, (SOH::Scene*)roomCtx->curRoom.segment); func_80123140(play, GET_PLAYER(play)); Actor_SpawnTransitionActors(play, &play->actorCtx); if (((play->sceneId != SCENE_IKANA) || (roomCtx->curRoom.num != 1)) && (play->sceneId != SCENE_IKNINSIDE)) { diff --git a/mm/2s2h/z_scene_2SH.cpp b/mm/2s2h/z_scene_2SH.cpp index 5d229f013..11ba1a74d 100644 --- a/mm/2s2h/z_scene_2SH.cpp +++ b/mm/2s2h/z_scene_2SH.cpp @@ -10,7 +10,6 @@ #include "2s2h/resource/type/CollisionHeader.h" #include "2s2h/resource/type/Cutscene.h" #include "2s2h/resource/type/Path.h" -#include "2s2h/resource/type/Text.h" #include "2s2h/resource/type/scenecommand/SetCameraSettings.h" #include "2s2h/resource/type/scenecommand/SetCutscenes.h" #include "2s2h/resource/type/scenecommand/SetStartPositionList.h" @@ -39,11 +38,11 @@ #include "2s2h/resource/type/scenecommand/SetMinimapChests.h" #include "2s2h/resource/type/scenecommand/SetCsCamera.h" -s32 OTRScene_ExecuteCommands(PlayState* play, LUS::Scene* scene); +s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene); -void Scene_CommandSpawnList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetStartPositionList* list = (LUS::SetStartPositionList*)cmd; +void Scene_CommandSpawnList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetStartPositionList* list = (SOH::SetStartPositionList*)cmd; ActorEntry* entries = (ActorEntry*)(list->GetRawPointer()); s32 loadedCount; s16 playerObjectId; @@ -70,33 +69,33 @@ void Scene_CommandSpawnList(PlayState* play, LUS::ISceneCommand* cmd) { play->objectCtx.slots[play->objectCtx.numEntries].segment = objectPtr; } -void Scene_CommandActorList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetActorList* list = (LUS::SetActorList*)cmd; +void Scene_CommandActorList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetActorList* list = (SOH::SetActorList*)cmd; play->numSetupActors = list->numActors; play->actorCtx.halfDaysBit = 0; play->setupActorList = (ActorEntry*)list->GetRawPointer(); } -void Scene_CommandActorCutsceneCamList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetCsCamera* cams = (LUS::SetCsCamera*)cmd; +void Scene_CommandActorCutsceneCamList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetCsCamera* cams = (SOH::SetCsCamera*)cmd; play->actorCsCamList = (ActorCsCamInfo*)cams->GetPointer(); } -void Scene_CommandCollisionHeader(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetCollisionHeader* colHeader = (LUS::SetCollisionHeader*)cmd; +void Scene_CommandCollisionHeader(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetCollisionHeader* colHeader = (SOH::SetCollisionHeader*)cmd; BgCheck_Allocate(&play->colCtx, play, (CollisionHeader*)colHeader->GetRawPointer()); } -void Scene_CommandRoomList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetRoomList* list = (LUS::SetRoomList*)cmd; +void Scene_CommandRoomList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetRoomList* list = (SOH::SetRoomList*)cmd; play->numRooms = list->numRooms; play->roomList = (RomFile*)list->GetPointer(); } -void Scene_CommandWindSettings(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetWindSettings* settings = (LUS::SetWindSettings*)cmd; +void Scene_CommandWindSettings(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetWindSettings* settings = (SOH::SetWindSettings*)cmd; play->envCtx.windDirection.x = settings->settings.windWest; play->envCtx.windDirection.y = settings->settings.windVertical; @@ -104,14 +103,14 @@ void Scene_CommandWindSettings(PlayState* play, LUS::ISceneCommand* cmd) { play->envCtx.windSpeed = settings->settings.windSpeed; } -void Scene_CommandEntranceList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetEntranceList* list = (LUS::SetEntranceList*)cmd; +void Scene_CommandEntranceList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetEntranceList* list = (SOH::SetEntranceList*)cmd; play->setupEntranceList = (EntranceEntry*)list->GetRawPointer(); } -void Scene_CommandSpecialFiles(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetSpecialObjects* specialObjList = (LUS::SetSpecialObjects*)cmd; +void Scene_CommandSpecialFiles(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetSpecialObjects* specialObjList = (SOH::SetSpecialObjects*)cmd; // static RomFile naviQuestHintFiles[2] = { // { SEGMENT_ROM_START(elf_message_field), SEGMENT_ROM_END(elf_message_field) }, // { SEGMENT_ROM_START(elf_message_ydan), SEGMENT_ROM_END(elf_message_ydan) }, @@ -129,8 +128,8 @@ void Scene_CommandSpecialFiles(PlayState* play, LUS::ISceneCommand* cmd) { // } } -void Scene_CommandRoomBehavior(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetRoomBehaviorMM* behavior = (LUS::SetRoomBehaviorMM*)cmd; +void Scene_CommandRoomBehavior(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetRoomBehaviorMM* behavior = (SOH::SetRoomBehaviorMM*)cmd; play->roomCtx.curRoom.behaviorType1 = behavior->roomBehavior.gameplayFlags; play->roomCtx.curRoom.behaviorType2 = behavior->roomBehavior.currRoomUnk2; @@ -146,18 +145,18 @@ void Scene_CommandRoomBehavior(PlayState* play, LUS::ISceneCommand* cmd) { //play->envCtx.stormState = (behavior->roomBehavior.gameplayFlags2 >> 0xC) & 1; } -void Scene_Command09(PlayState* play, LUS::ISceneCommand* cmd) { +void Scene_Command09(PlayState* play, SOH::ISceneCommand* cmd) { // Empty in z_scene.c } -void Scene_CommandMesh(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetMesh* mesh = (LUS::SetMesh*)cmd; +void Scene_CommandMesh(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetMesh* mesh = (SOH::SetMesh*)cmd; play->roomCtx.curRoom.roomShape = (RoomShape*)mesh->GetRawPointer(); } -void Scene_CommandObjectList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetObjectList* objList = (LUS::SetObjectList*)cmd; +void Scene_CommandObjectList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetObjectList* objList = (SOH::SetObjectList*)cmd; s32 i; s32 j; s32 k; @@ -236,36 +235,36 @@ void Scene_CommandObjectList(PlayState* play, LUS::ISceneCommand* cmd) { // play->objectCtx.numEntries = i; } -void Scene_CommandLightList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetLightList* lightList = (LUS::SetLightList*)cmd; +void Scene_CommandLightList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetLightList* lightList = (SOH::SetLightList*)cmd; for (unsigned int i = 0; i < lightList->numLights; i++) { LightContext_InsertLight(play, &play->lightCtx, (LightInfo*)&lightList->lightList[i]); } } -void Scene_CommandPathList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetPathwaysMM* paths = (LUS::SetPathwaysMM*)cmd; +void Scene_CommandPathList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetPathwaysMM* paths = (SOH::SetPathwaysMM*)cmd; play->setupPathList = (Path*)paths->GetPointer()[0]; } -void Scene_CommandTransiActorList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetTransitionActorList* list = (LUS::SetTransitionActorList*)cmd; +void Scene_CommandTransiActorList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetTransitionActorList* list = (SOH::SetTransitionActorList*)cmd; play->transitionActors.count = list->numTransitionActors; play->transitionActors.list = (TransitionActorEntry*)list->GetRawPointer(); } -void Scene_CommandEnvLightSettings(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetLightingSettings* lightSettings = (LUS::SetLightingSettings*)cmd; +void Scene_CommandEnvLightSettings(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetLightingSettings* lightSettings = (SOH::SetLightingSettings*)cmd; play->envCtx.numLightSettings = lightSettings->settings.size(); play->envCtx.lightSettingsList = (EnvLightSettings*)lightSettings->GetRawPointer(); } -void Scene_CommandTimeSettings(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetTimeSettings* settings = (LUS::SetTimeSettings*)cmd; +void Scene_CommandTimeSettings(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetTimeSettings* settings = (SOH::SetTimeSettings*)cmd; if ((settings->settings.hour != 0xFF) && (settings->settings.minute != 0xFF)) { gSaveContext.skyboxTime = gSaveContext.save.time = CLOCK_TIME_ALT2_F(settings->settings.hour, settings->settings.minute); @@ -305,8 +304,8 @@ void Scene_CommandTimeSettings(PlayState* play, LUS::ISceneCommand* cmd) { } } -void Scene_CommandSkyboxSettings(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetSkyboxSettings* settings = (LUS::SetSkyboxSettings*)cmd; +void Scene_CommandSkyboxSettings(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetSkyboxSettings* settings = (SOH::SetSkyboxSettings*)cmd; play->skyboxId = settings->settings.skyboxId & 3; // BENTODO z_scene.c reads from skyboxSettings.skyboxConfig not weather @@ -316,19 +315,19 @@ void Scene_CommandSkyboxSettings(PlayState* play, LUS::ISceneCommand* cmd) { //Scene_LoadAreaTextures(play, settings->settings.) } -void Scene_CommandSkyboxDisables(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetSkyboxModifier* mod = (LUS::SetSkyboxModifier*)cmd; +void Scene_CommandSkyboxDisables(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetSkyboxModifier* mod = (SOH::SetSkyboxModifier*)cmd; play->envCtx.skyboxDisabled = mod->modifier.skyboxDisabled; play->envCtx.sunDisabled = mod->modifier.sunMoonDisabled; } -void Scene_CommandExitList(PlayState* play, LUS::ISceneCommand* cmd) { +void Scene_CommandExitList(PlayState* play, SOH::ISceneCommand* cmd) { play->setupExitList = (u16*)cmd->GetRawPointer(); } -void Scene_CommandSoundSettings(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetSoundSettings* settings = (LUS::SetSoundSettings*)cmd; +void Scene_CommandSoundSettings(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetSoundSettings* settings = (SOH::SetSoundSettings*)cmd; play->sequenceCtx.seqId = settings->settings.seqId; play->sequenceCtx.ambienceId = settings->settings.natureAmbienceId; @@ -338,13 +337,13 @@ void Scene_CommandSoundSettings(PlayState* play, LUS::ISceneCommand* cmd) { } } -void Scene_CommandEchoSetting(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetEchoSettings* echo = (LUS::SetEchoSettings*)cmd; +void Scene_CommandEchoSetting(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetEchoSettings* echo = (SOH::SetEchoSettings*)cmd; play->roomCtx.curRoom.echo = echo->settings.echo; } -void Scene_CommandCutsceneScriptList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetCutscenesMM* cs = (LUS::SetCutscenesMM*)cmd; +void Scene_CommandCutsceneScriptList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetCutscenesMM* cs = (SOH::SetCutscenesMM*)cmd; play->csCtx.scriptListCount = cs->entries.size(); // BENTODO do this the right way with get pointer play->csCtx.scriptList = (CutsceneScriptEntry*)cs->entries.data(); @@ -352,12 +351,12 @@ void Scene_CommandCutsceneScriptList(PlayState* play, LUS::ISceneCommand* cmd) { } static bool shouldEndSceneCommands = false; -void Scene_CommandAltHeaderList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetAlternateHeaders* headers = (LUS::SetAlternateHeaders*)cmd; +void Scene_CommandAltHeaderList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetAlternateHeaders* headers = (SOH::SetAlternateHeaders*)cmd; if (gSaveContext.sceneLayer != 0) { - LUS::Scene* desiredHeader = - std::static_pointer_cast(headers->headers[gSaveContext.sceneLayer - 1]).get(); + SOH::Scene* desiredHeader = + std::static_pointer_cast(headers->headers[gSaveContext.sceneLayer - 1]).get(); if (desiredHeader != nullptr) { OTRScene_ExecuteCommands(play, desiredHeader); @@ -369,7 +368,7 @@ void Scene_CommandAltHeaderList(PlayState* play, LUS::ISceneCommand* cmd) { } } -void Scene_CommandSetRegionVisitedFlag(PlayState* play, LUS::ISceneCommand* cmd) { +void Scene_CommandSetRegionVisitedFlag(PlayState* play, SOH::ISceneCommand* cmd) { s16 j = 0; s16 i = 0; @@ -396,36 +395,36 @@ void Scene_CommandSetRegionVisitedFlag(PlayState* play, LUS::ISceneCommand* cmd) } } -void Scene_CommandAnimatedMaterials(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetAnimatedMaterialList* list = (LUS::SetAnimatedMaterialList*)cmd; +void Scene_CommandAnimatedMaterials(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetAnimatedMaterialList* list = (SOH::SetAnimatedMaterialList*)cmd; play->sceneMaterialAnims = (AnimatedMaterial*)list->mat; } -void Scene_CommandCutsceneList(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetActorCutsceneList* list = (LUS::SetActorCutsceneList*)cmd; +void Scene_CommandCutsceneList(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetActorCutsceneList* list = (SOH::SetActorCutsceneList*)cmd; - CutsceneManager_Init(play, (ActorCutscene*)list->GetPointer(), list->numEntries); + CutsceneManager_Init(play, (ActorCutscene*)list->GetPointer(), list->entries.size()); } -void Scene_CommandMiniMap(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetMinimapList* list = (LUS::SetMinimapList*)cmd; +void Scene_CommandMiniMap(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetMinimapList* list = (SOH::SetMinimapList*)cmd; MapDisp_Init(play); MapDisp_InitMapData(play, list->GetPointer()); } -void Scene_Command1D(PlayState* play, LUS::ISceneCommand* cmd) { +void Scene_Command1D(PlayState* play, SOH::ISceneCommand* cmd) { } -void Scene_CommandMiniMapCompassInfo(PlayState* play, LUS::ISceneCommand* cmd) { - LUS::SetMinimapChests* chests = (LUS::SetMinimapChests*)cmd; +void Scene_CommandMiniMapCompassInfo(PlayState* play, SOH::ISceneCommand* cmd) { + SOH::SetMinimapChests* chests = (SOH::SetMinimapChests*)cmd; MapDisp_InitChestData(play, chests->chests.size(), chests->GetPointer()); } -void (*sSceneCmdHandlersOTR[SCENE_CMD_MAX])(PlayState*, LUS::ISceneCommand*) = { +void (*sSceneCmdHandlersOTR[SCENE_CMD_MAX])(PlayState*, SOH::ISceneCommand*) = { Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST Scene_CommandActorCutsceneCamList, // SCENE_CMD_ID_ACTOR_CUTSCENE_CAM_LIST @@ -459,8 +458,8 @@ void (*sSceneCmdHandlersOTR[SCENE_CMD_MAX])(PlayState*, LUS::ISceneCommand*) = { Scene_CommandMiniMapCompassInfo, // SCENE_CMD_ID_MINIMAP_COMPASS_ICON_INFO }; -s32 OTRScene_ExecuteCommands(PlayState* play, LUS::Scene* scene) { - LUS::SceneCommandID cmdId; +s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene) { + SOH::SceneCommandID cmdId; shouldEndSceneCommands = false; for (int i = 0; i < scene->commands.size(); i++) { @@ -468,17 +467,17 @@ s32 OTRScene_ExecuteCommands(PlayState* play, LUS::Scene* scene) { cmdId = sceneCmd->cmdId; // 2S2H [Port] This opcode is not in the original game. Its a special command for OTRs, for supporting multiple games - if (cmdId == LUS::SceneCommandID::SetCutscenesMM) { - cmdId = LUS::SceneCommandID::SetCutscenes; + if (cmdId == SOH::SceneCommandID::SetCutscenesMM) { + cmdId = SOH::SceneCommandID::SetCutscenes; } // 2S2H [Port] shouldEndSceneCommands is set when an alternate header list is found - if (cmdId == LUS::SceneCommandID::EndMarker || shouldEndSceneCommands) { + if (cmdId == SOH::SceneCommandID::EndMarker || shouldEndSceneCommands) { shouldEndSceneCommands = false; break; } - if (cmdId < LUS::SceneCommandID::SetCutscenesMM) { + if (cmdId < SOH::SceneCommandID::SetCutscenesMM) { sSceneCmdHandlersOTR[(int)cmdId](play, sceneCmd.get()); } } @@ -511,7 +510,7 @@ extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomN //&roomCtx->loadQueue, NULL, __FILE__, __LINE__); printf("File Name %s\n", play->roomList[roomNum].fileName); auto roomData = - std::static_pointer_cast(GetResourceByNameHandlingMQ(play->roomList[roomNum].fileName)); + std::static_pointer_cast(GetResourceByNameHandlingMQ(play->roomList[roomNum].fileName)); roomCtx->status = 1; roomCtx->activeRoomVram = roomData.get(); diff --git a/mm/CMakeLists.txt b/mm/CMakeLists.txt index 87bb4c604..96f99eb80 100644 --- a/mm/CMakeLists.txt +++ b/mm/CMakeLists.txt @@ -105,7 +105,7 @@ set(PROJECT_NAME mm) ################################################################################ # Sources ################################################################################ -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/build.c.in ${CMAKE_BINARY_DIR}/build.c @ONLY) +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/build.c.in ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/build.c @ONLY) #configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/properties.h.in ${CMAKE_CURRENT_SOURCE_DIR}/properties.h @ONLY) #set(Header_Files "resource.h") @@ -237,7 +237,6 @@ source_group("2s2h\\resource\\importer\\scenecommand" REGULAR_EXPRESSION "2s2h/r # src (decomp) {{{ file(GLOB_RECURSE src__ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.c" "src/*.h") -list(APPEND src__ ${CMAKE_BINARY_DIR}/build.c) #list(APPEND src__ ${CMAKE_CURRENT_SOURCE_DIR}/properties.h) #list(APPEND src__ ${CMAKE_CURRENT_SOURCE_DIR}/Resource.rc) list(FILTER src__ EXCLUDE REGEX "src/dmadata/*") @@ -259,7 +258,6 @@ list(FILTER src__ EXCLUDE REGEX "src/libultra/*") #list(REMOVE_ITEM src__ "src/libultra/gu/us2dex.c") source_group("src" REGULAR_EXPRESSION "src/*") -source_group("src\\build" FILES ${CMAKE_BINARY_DIR}/build.c) source_group("src\\boot" REGULAR_EXPRESSION "src/boot/*") source_group("src\\buffers" REGULAR_EXPRESSION "src/buffers/*") source_group("src\\code" REGULAR_EXPRESSION "src/code/*") @@ -677,15 +675,6 @@ endif() ################################################################################ # Pre build events ################################################################################ -if (CMAKE_SYSTEM_NAME STREQUAL "Windows") - add_custom_command_if( - TARGET ${PROJECT_NAME} - PRE_BUILD - COMMANDS - COMMAND $ copy /b $build.c +,, - ) -endif() - if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS") add_custom_command( TARGET ${PROJECT_NAME} diff --git a/mm/assets/.gitignore b/mm/assets/.gitignore index 7e53529fc..fec19cf96 100644 --- a/mm/assets/.gitignore +++ b/mm/assets/.gitignore @@ -4,3 +4,6 @@ *.cfg *.vtx.inc *.dlist.inc + +# Unignore our custom assets +!custom/**/* diff --git a/mm/assets/custom/accessibility/texts/filechoose_eng.json b/mm/assets/custom/accessibility/texts/filechoose_eng.json new file mode 100644 index 000000000..6a634a83a --- /dev/null +++ b/mm/assets/custom/accessibility/texts/filechoose_eng.json @@ -0,0 +1,28 @@ +{ + "file1": "File 1", + "file2": "File 2", + "file3": "File 3", + "options": "Options", + "copy": "Copy", + "erase": "Erase", + "quit": "Quit", + "confirm": "Yes", + "end": "End", + "hyphen": "Hyphen", + "period": "Period", + "space": "Space", + "backspace": "Backspace", + "capital_letter": "Capital $0", + "audio_stereo": "Sound - Stereo", + "audio_mono": "Sound - Mono", + "audio_headset": "Sound - Headset", + "audio_surround": "Sound - Surround", + "target_switch": "Targeting Mode - Switch", + "target_hold": "Targeting Mode - Hold", + "language_english": "Language - English", + "language_german": "Language - German", + "language_french": "Language - French", + "quest_sel_vanilla": "Quest - Original", + "quest_sel_randomizer": "Quest - Randomizer", + "quest_sel_boss_rush": "Quest - Boss Rush" +} diff --git a/mm/assets/custom/accessibility/texts/kaleidoscope_eng.json b/mm/assets/custom/accessibility/texts/kaleidoscope_eng.json new file mode 100644 index 000000000..0c6786a83 --- /dev/null +++ b/mm/assets/custom/accessibility/texts/kaleidoscope_eng.json @@ -0,0 +1,18 @@ +{ + "health": "Health - $0 Hearts", + "magic": "Magic - $0", + "rupees": "Rupees - $0", + "floor": "Floor $0", + "basement": "Basement $0", + "item_menu": "Select Item", + "map_menu": "Map - $0", + "quest_menu": "Quest Status", + "equip_menu": "Equipment", + "overworld": "Overworld", + "equipped": "$0 - Equipped", + "save_prompt": "Would you like to save?", + "game_saved": "Game saved", + "game_over": "Game Over", + "continue_game": "Continue playing?", + "assigned_to": "Assigned to $0" +} diff --git a/mm/assets/custom/accessibility/texts/misc_eng.json b/mm/assets/custom/accessibility/texts/misc_eng.json new file mode 100644 index 000000000..6bff3b328 --- /dev/null +++ b/mm/assets/custom/accessibility/texts/misc_eng.json @@ -0,0 +1,24 @@ +{ + "minutes_plural" : "$0 minutes", + "minutes_singular" : "$0 minute", + "seconds_plural" : "$0 seconds", + "seconds_singular" : "$0 second", + "input_button_a": "the A button", + "input_button_b": "the B button", + "input_button_c": "the C button", + "input_button_l": "the L button", + "input_button_r": "the R button", + "input_button_z": "the Z button", + "input_button_c_up": "C Up", + "input_button_c_down": "C Down", + "input_button_c_left": "C Left", + "input_button_c_right": "C Right", + "input_analog_stick": "the Analog Stick", + "input_d_pad": "the D-Pad", + "input_d_pad_up": "D-Pad Up", + "input_d_pad_down": "D-Pad Down", + "input_d_pad_left": "D-Pad Left", + "input_d_pad_right": "D-Pad Right", + "yes": "Yes", + "no": "No" +} diff --git a/mm/assets/custom/accessibility/texts/scenes_eng.json b/mm/assets/custom/accessibility/texts/scenes_eng.json new file mode 100644 index 000000000..e5b7037dd --- /dev/null +++ b/mm/assets/custom/accessibility/texts/scenes_eng.json @@ -0,0 +1,3 @@ +{ + "0": "" +} diff --git a/mm/assets/custom/fonts/Fipps-Regular.otf b/mm/assets/custom/fonts/Fipps-Regular.otf new file mode 100644 index 000000000..9334dad59 Binary files /dev/null and b/mm/assets/custom/fonts/Fipps-Regular.otf differ diff --git a/mm/assets/custom/fonts/PressStart2P-Regular.ttf b/mm/assets/custom/fonts/PressStart2P-Regular.ttf new file mode 100644 index 000000000..2442affbf Binary files /dev/null and b/mm/assets/custom/fonts/PressStart2P-Regular.ttf differ diff --git a/mm/assets/custom/helpers/cosmetics/gEndGrayscaleAndEndDlistDL b/mm/assets/custom/helpers/cosmetics/gEndGrayscaleAndEndDlistDL new file mode 100644 index 000000000..d7f9ce45c --- /dev/null +++ b/mm/assets/custom/helpers/cosmetics/gEndGrayscaleAndEndDlistDL @@ -0,0 +1,5 @@ + + + + + diff --git a/mm/assets/custom/objects/object_box/gChristmasGreenTreasureChestFrontTex.rgb5a1.png b/mm/assets/custom/objects/object_box/gChristmasGreenTreasureChestFrontTex.rgb5a1.png new file mode 100644 index 000000000..03dac76dd Binary files /dev/null and b/mm/assets/custom/objects/object_box/gChristmasGreenTreasureChestFrontTex.rgb5a1.png differ diff --git a/mm/assets/custom/objects/object_box/gChristmasGreenTreasureChestSideAndTopTex.rgb5a1.png b/mm/assets/custom/objects/object_box/gChristmasGreenTreasureChestSideAndTopTex.rgb5a1.png new file mode 100644 index 000000000..ee03c1343 Binary files /dev/null and b/mm/assets/custom/objects/object_box/gChristmasGreenTreasureChestSideAndTopTex.rgb5a1.png differ diff --git a/mm/assets/custom/objects/object_box/gChristmasRedTreasureChestFrontTex.rgb5a1.png b/mm/assets/custom/objects/object_box/gChristmasRedTreasureChestFrontTex.rgb5a1.png new file mode 100644 index 000000000..0ea4b9fe2 Binary files /dev/null and b/mm/assets/custom/objects/object_box/gChristmasRedTreasureChestFrontTex.rgb5a1.png differ diff --git a/mm/assets/custom/objects/object_box/gChristmasRedTreasureChestSideAndTopTex.rgb5a1.png b/mm/assets/custom/objects/object_box/gChristmasRedTreasureChestSideAndTopTex.rgb5a1.png new file mode 100644 index 000000000..ccba6385d Binary files /dev/null and b/mm/assets/custom/objects/object_box/gChristmasRedTreasureChestSideAndTopTex.rgb5a1.png differ diff --git a/mm/assets/custom/objects/object_box/gGoldTreasureChestFrontTex.rgb5a1.png b/mm/assets/custom/objects/object_box/gGoldTreasureChestFrontTex.rgb5a1.png new file mode 100644 index 000000000..d63811e9c Binary files /dev/null and b/mm/assets/custom/objects/object_box/gGoldTreasureChestFrontTex.rgb5a1.png differ diff --git a/mm/assets/custom/objects/object_box/gGoldTreasureChestSideAndTopTex.rgb5a1.png b/mm/assets/custom/objects/object_box/gGoldTreasureChestSideAndTopTex.rgb5a1.png new file mode 100644 index 000000000..b2e914b49 Binary files /dev/null and b/mm/assets/custom/objects/object_box/gGoldTreasureChestSideAndTopTex.rgb5a1.png differ diff --git a/mm/assets/custom/objects/object_box/gKeyTreasureChestFrontTex.rgb5a1.png b/mm/assets/custom/objects/object_box/gKeyTreasureChestFrontTex.rgb5a1.png new file mode 100644 index 000000000..6e012c263 Binary files /dev/null and b/mm/assets/custom/objects/object_box/gKeyTreasureChestFrontTex.rgb5a1.png differ diff --git a/mm/assets/custom/objects/object_box/gKeyTreasureChestSideAndTopTex.rgb5a1.png b/mm/assets/custom/objects/object_box/gKeyTreasureChestSideAndTopTex.rgb5a1.png new file mode 100644 index 000000000..8d320f250 Binary files /dev/null and b/mm/assets/custom/objects/object_box/gKeyTreasureChestSideAndTopTex.rgb5a1.png differ diff --git a/mm/assets/custom/objects/object_box/gSkullTreasureChestFrontTex.rgb5a1.png b/mm/assets/custom/objects/object_box/gSkullTreasureChestFrontTex.rgb5a1.png new file mode 100644 index 000000000..00f0b39e4 Binary files /dev/null and b/mm/assets/custom/objects/object_box/gSkullTreasureChestFrontTex.rgb5a1.png differ diff --git a/mm/assets/custom/objects/object_box/gSkullTreasureChestSideAndTopTex.rgb5a1.png b/mm/assets/custom/objects/object_box/gSkullTreasureChestSideAndTopTex.rgb5a1.png new file mode 100644 index 000000000..0a09e2b6f Binary files /dev/null and b/mm/assets/custom/objects/object_box/gSkullTreasureChestSideAndTopTex.rgb5a1.png differ diff --git a/mm/assets/custom/objects/object_mag/gTitleBossRushSubtitleTex.rgba32.png b/mm/assets/custom/objects/object_mag/gTitleBossRushSubtitleTex.rgba32.png new file mode 100644 index 000000000..624a29923 Binary files /dev/null and b/mm/assets/custom/objects/object_mag/gTitleBossRushSubtitleTex.rgba32.png differ diff --git a/mm/assets/custom/objects/object_mag/gTitleRandomizerSubtitleTex.rgba32.png b/mm/assets/custom/objects/object_mag/gTitleRandomizerSubtitleTex.rgba32.png new file mode 100644 index 000000000..a61a058a8 Binary files /dev/null and b/mm/assets/custom/objects/object_mag/gTitleRandomizerSubtitleTex.rgba32.png differ diff --git a/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL b/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL new file mode 100644 index 000000000..966bef206 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_tri_0 b/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_tri_0 new file mode 100644 index 000000000..dea47708c --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_tri_0 @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_tri_1 b/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_tri_1 new file mode 100644 index 000000000..36be4333f --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_tri_1 @@ -0,0 +1,7 @@ + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_vtx_0 b/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_vtx_0 new file mode 100644 index 000000000..6ca96db30 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_vtx_0 @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_vtx_1 b/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_vtx_1 new file mode 100644 index 000000000..3a653966d --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_completed/gTriforcePieceCompletedDL_vtx_1 @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_completed/mat_gTriforcePieceCompletedDL_f3dlite_triforce_edges b/mm/assets/custom/objects/object_triforce_completed/mat_gTriforcePieceCompletedDL_f3dlite_triforce_edges new file mode 100644 index 000000000..52591dfc8 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_completed/mat_gTriforcePieceCompletedDL_f3dlite_triforce_edges @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_completed/mat_gTriforcePieceCompletedDL_f3dlite_triforce_surface b/mm/assets/custom/objects/object_triforce_completed/mat_gTriforcePieceCompletedDL_f3dlite_triforce_surface new file mode 100644 index 000000000..06193ae61 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_completed/mat_gTriforcePieceCompletedDL_f3dlite_triforce_surface @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_completed/noise_tex b/mm/assets/custom/objects/object_triforce_completed/noise_tex new file mode 100644 index 000000000..a6d6cf945 Binary files /dev/null and b/mm/assets/custom/objects/object_triforce_completed/noise_tex differ diff --git a/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL new file mode 100644 index 000000000..70d08c31d --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_tri_0 b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_tri_0 new file mode 100644 index 000000000..09e44f1b7 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_tri_0 @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_tri_1 b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_tri_1 new file mode 100644 index 000000000..48001e3c3 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_tri_1 @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_tri_2 b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_tri_2 new file mode 100644 index 000000000..e35e34492 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_tri_2 @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_vtx_0 b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_vtx_0 new file mode 100644 index 000000000..a86fa98bf --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_vtx_0 @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_vtx_1 b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_vtx_1 new file mode 100644 index 000000000..230fbb7f8 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_vtx_1 @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_vtx_2 b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_vtx_2 new file mode 100644 index 000000000..86d123825 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_0/gTriforcePiece0DL_vtx_2 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_0/mat_gTriforcePiece0DL_f3dlite_shard_edge b/mm/assets/custom/objects/object_triforce_piece_0/mat_gTriforcePiece0DL_f3dlite_shard_edge new file mode 100644 index 000000000..f62631793 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_0/mat_gTriforcePiece0DL_f3dlite_shard_edge @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_0/mat_gTriforcePiece0DL_f3dlite_triforce_edges b/mm/assets/custom/objects/object_triforce_piece_0/mat_gTriforcePiece0DL_f3dlite_triforce_edges new file mode 100644 index 000000000..9355e7094 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_0/mat_gTriforcePiece0DL_f3dlite_triforce_edges @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_0/mat_gTriforcePiece0DL_f3dlite_triforce_surface b/mm/assets/custom/objects/object_triforce_piece_0/mat_gTriforcePiece0DL_f3dlite_triforce_surface new file mode 100644 index 000000000..e863b31c5 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_0/mat_gTriforcePiece0DL_f3dlite_triforce_surface @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_0/noise_tex b/mm/assets/custom/objects/object_triforce_piece_0/noise_tex new file mode 100644 index 000000000..a6d6cf945 Binary files /dev/null and b/mm/assets/custom/objects/object_triforce_piece_0/noise_tex differ diff --git a/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL b/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL new file mode 100644 index 000000000..50a9264c6 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_tri_0 b/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_tri_0 new file mode 100644 index 000000000..5f33f7347 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_tri_0 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_tri_1 b/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_tri_1 new file mode 100644 index 000000000..43df6492b --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_tri_1 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_vtx_0 b/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_vtx_0 new file mode 100644 index 000000000..e078b8246 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_vtx_0 @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_vtx_1 b/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_vtx_1 new file mode 100644 index 000000000..e0460194d --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_1/gTriforcePiece1DL_vtx_1 @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_1/mat_gTriforcePiece1DL_f3dlite_shard_edge b/mm/assets/custom/objects/object_triforce_piece_1/mat_gTriforcePiece1DL_f3dlite_shard_edge new file mode 100644 index 000000000..b9e61293d --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_1/mat_gTriforcePiece1DL_f3dlite_shard_edge @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_1/mat_gTriforcePiece1DL_f3dlite_triforce_surface b/mm/assets/custom/objects/object_triforce_piece_1/mat_gTriforcePiece1DL_f3dlite_triforce_surface new file mode 100644 index 000000000..5f8dc51f9 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_1/mat_gTriforcePiece1DL_f3dlite_triforce_surface @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_1/noise_tex b/mm/assets/custom/objects/object_triforce_piece_1/noise_tex new file mode 100644 index 000000000..a6d6cf945 Binary files /dev/null and b/mm/assets/custom/objects/object_triforce_piece_1/noise_tex differ diff --git a/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL new file mode 100644 index 000000000..5213cd53c --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_tri_0 b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_tri_0 new file mode 100644 index 000000000..b54e182d5 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_tri_0 @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_tri_1 b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_tri_1 new file mode 100644 index 000000000..00a32bfd8 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_tri_1 @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_tri_2 b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_tri_2 new file mode 100644 index 000000000..0993c1c1e --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_tri_2 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_vtx_0 b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_vtx_0 new file mode 100644 index 000000000..bf7dfcac6 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_vtx_0 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_vtx_1 b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_vtx_1 new file mode 100644 index 000000000..e3237ab21 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_vtx_1 @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_vtx_2 b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_vtx_2 new file mode 100644 index 000000000..ec4e73700 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_2/gTriforcePiece2DL_vtx_2 @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_2/mat_gTriforcePiece2DL_f3dlite_shard_edge b/mm/assets/custom/objects/object_triforce_piece_2/mat_gTriforcePiece2DL_f3dlite_shard_edge new file mode 100644 index 000000000..c222fe68d --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_2/mat_gTriforcePiece2DL_f3dlite_shard_edge @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_2/mat_gTriforcePiece2DL_f3dlite_triforce_edges b/mm/assets/custom/objects/object_triforce_piece_2/mat_gTriforcePiece2DL_f3dlite_triforce_edges new file mode 100644 index 000000000..5968068f5 --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_2/mat_gTriforcePiece2DL_f3dlite_triforce_edges @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_2/mat_gTriforcePiece2DL_f3dlite_triforce_surface b/mm/assets/custom/objects/object_triforce_piece_2/mat_gTriforcePiece2DL_f3dlite_triforce_surface new file mode 100644 index 000000000..d903f00bb --- /dev/null +++ b/mm/assets/custom/objects/object_triforce_piece_2/mat_gTriforcePiece2DL_f3dlite_triforce_surface @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/objects/object_triforce_piece_2/noise_tex b/mm/assets/custom/objects/object_triforce_piece_2/noise_tex new file mode 100644 index 000000000..a6d6cf945 Binary files /dev/null and b/mm/assets/custom/objects/object_triforce_piece_2/noise_tex differ diff --git a/mm/assets/custom/textures/buttons/ABtn.png b/mm/assets/custom/textures/buttons/ABtn.png new file mode 100644 index 000000000..c1b06571c Binary files /dev/null and b/mm/assets/custom/textures/buttons/ABtn.png differ diff --git a/mm/assets/custom/textures/buttons/BBtn.png b/mm/assets/custom/textures/buttons/BBtn.png new file mode 100644 index 000000000..99b1197c9 Binary files /dev/null and b/mm/assets/custom/textures/buttons/BBtn.png differ diff --git a/mm/assets/custom/textures/buttons/CDown.png b/mm/assets/custom/textures/buttons/CDown.png new file mode 100644 index 000000000..741188eaf Binary files /dev/null and b/mm/assets/custom/textures/buttons/CDown.png differ diff --git a/mm/assets/custom/textures/buttons/CLeft.png b/mm/assets/custom/textures/buttons/CLeft.png new file mode 100644 index 000000000..5e26a2067 Binary files /dev/null and b/mm/assets/custom/textures/buttons/CLeft.png differ diff --git a/mm/assets/custom/textures/buttons/CRight.png b/mm/assets/custom/textures/buttons/CRight.png new file mode 100644 index 000000000..9e6180639 Binary files /dev/null and b/mm/assets/custom/textures/buttons/CRight.png differ diff --git a/mm/assets/custom/textures/buttons/CUp.png b/mm/assets/custom/textures/buttons/CUp.png new file mode 100644 index 000000000..6c0e29d2d Binary files /dev/null and b/mm/assets/custom/textures/buttons/CUp.png differ diff --git a/mm/assets/custom/textures/buttons/LBtn.png b/mm/assets/custom/textures/buttons/LBtn.png new file mode 100644 index 000000000..2e0a8f00c Binary files /dev/null and b/mm/assets/custom/textures/buttons/LBtn.png differ diff --git a/mm/assets/custom/textures/buttons/RBtn.png b/mm/assets/custom/textures/buttons/RBtn.png new file mode 100644 index 000000000..c255643c3 Binary files /dev/null and b/mm/assets/custom/textures/buttons/RBtn.png differ diff --git a/mm/assets/custom/textures/buttons/StartBtn.png b/mm/assets/custom/textures/buttons/StartBtn.png new file mode 100644 index 000000000..c3e08dc36 Binary files /dev/null and b/mm/assets/custom/textures/buttons/StartBtn.png differ diff --git a/mm/assets/custom/textures/buttons/ZBtn.png b/mm/assets/custom/textures/buttons/ZBtn.png new file mode 100644 index 000000000..def8d9a6d Binary files /dev/null and b/mm/assets/custom/textures/buttons/ZBtn.png differ diff --git a/mm/assets/custom/textures/icons/gIcon.png b/mm/assets/custom/textures/icons/gIcon.png new file mode 100644 index 000000000..e81a0fbce Binary files /dev/null and b/mm/assets/custom/textures/icons/gIcon.png differ diff --git a/mm/assets/custom/textures/nintendo_rogo_static/SoHShiny b/mm/assets/custom/textures/nintendo_rogo_static/SoHShiny new file mode 100644 index 000000000..5e5c7b52b Binary files /dev/null and b/mm/assets/custom/textures/nintendo_rogo_static/SoHShiny differ diff --git a/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL new file mode 100644 index 000000000..5e5435d84 --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_0 b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_0 new file mode 100644 index 000000000..2986de72b --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_0 @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_1 b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_1 new file mode 100644 index 000000000..2aa9bea6d --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_1 @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_2 b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_2 new file mode 100644 index 000000000..2b8fe0d11 --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_2 @@ -0,0 +1,259 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_3 b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_3 new file mode 100644 index 000000000..53edaf74f --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_tri_3 @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_0 b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_0 new file mode 100644 index 000000000..2c2ee793b --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_0 @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_1 b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_1 new file mode 100644 index 000000000..ec462b114 --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_1 @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_2 b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_2 new file mode 100644 index 000000000..cc906e23e --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_2 @@ -0,0 +1,323 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_3 b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_3 new file mode 100644 index 000000000..68e4babcf --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/gShipLogoDL_vtx_3 @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material b/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material new file mode 100644 index 000000000..e48b335c0 --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material_001 b/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material_001 new file mode 100644 index 000000000..e98640319 --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material_001 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material_002 b/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material_002 new file mode 100644 index 000000000..b2db72d79 --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material_002 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material_003 b/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material_003 new file mode 100644 index 000000000..be60fd46b --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/mat_gShipLogoDL_f3d_material_003 @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material b/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material new file mode 100644 index 000000000..3cda02a88 --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material_001 b/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material_001 new file mode 100644 index 000000000..3cda02a88 --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material_001 @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material_002 b/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material_002 new file mode 100644 index 000000000..3cda02a88 --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material_002 @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material_003 b/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material_003 new file mode 100644 index 000000000..3cda02a88 --- /dev/null +++ b/mm/assets/custom/textures/nintendo_rogo_static/mat_revert_gShipLogoDL_f3d_material_003 @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/mm/assets/custom/textures/nintendo_rogo_static/nintendo_rogo_static_Tex_LUS_000000 b/mm/assets/custom/textures/nintendo_rogo_static/nintendo_rogo_static_Tex_LUS_000000 new file mode 100644 index 000000000..2edcaacb3 Binary files /dev/null and b/mm/assets/custom/textures/nintendo_rogo_static/nintendo_rogo_static_Tex_LUS_000000 differ diff --git a/mm/assets/custom/textures/parameter_static/gArrowDown.ia16.png b/mm/assets/custom/textures/parameter_static/gArrowDown.ia16.png new file mode 100644 index 000000000..cdb51d79c Binary files /dev/null and b/mm/assets/custom/textures/parameter_static/gArrowDown.ia16.png differ diff --git a/mm/assets/custom/textures/parameter_static/gArrowUp.ia16.png b/mm/assets/custom/textures/parameter_static/gArrowUp.ia16.png new file mode 100644 index 000000000..1ed3f1cdd Binary files /dev/null and b/mm/assets/custom/textures/parameter_static/gArrowUp.ia16.png differ diff --git a/mm/assets/custom/textures/parameter_static/gDPad.ia16.png b/mm/assets/custom/textures/parameter_static/gDPad.ia16.png new file mode 100644 index 000000000..fc818e0d1 Binary files /dev/null and b/mm/assets/custom/textures/parameter_static/gDPad.ia16.png differ diff --git a/mm/assets/custom/textures/parameter_static/gTriforcePiece.rgba32.png b/mm/assets/custom/textures/parameter_static/gTriforcePiece.rgba32.png new file mode 100644 index 000000000..cc67b6a13 Binary files /dev/null and b/mm/assets/custom/textures/parameter_static/gTriforcePiece.rgba32.png differ diff --git a/mm/assets/custom/textures/title_static/gFileSelBossRushSettingsENGTex.ia8.png b/mm/assets/custom/textures/title_static/gFileSelBossRushSettingsENGTex.ia8.png new file mode 100644 index 000000000..e7a7aaa88 Binary files /dev/null and b/mm/assets/custom/textures/title_static/gFileSelBossRushSettingsENGTex.ia8.png differ diff --git a/mm/assets/custom/textures/title_static/gFileSelBossRushSettingsFRATex.ia8.png b/mm/assets/custom/textures/title_static/gFileSelBossRushSettingsFRATex.ia8.png new file mode 100644 index 000000000..8cbf6339c Binary files /dev/null and b/mm/assets/custom/textures/title_static/gFileSelBossRushSettingsFRATex.ia8.png differ diff --git a/mm/assets/custom/textures/title_static/gFileSelBossRushSettingsGERTex.ia8.png b/mm/assets/custom/textures/title_static/gFileSelBossRushSettingsGERTex.ia8.png new file mode 100644 index 000000000..455390170 Binary files /dev/null and b/mm/assets/custom/textures/title_static/gFileSelBossRushSettingsGERTex.ia8.png differ diff --git a/mm/assets/custom/textures/title_static/gFileSelMQButtonTex.ia16.png b/mm/assets/custom/textures/title_static/gFileSelMQButtonTex.ia16.png new file mode 100644 index 000000000..076b9365f Binary files /dev/null and b/mm/assets/custom/textures/title_static/gFileSelMQButtonTex.ia16.png differ diff --git a/mm/assets/custom/textures/title_static/gFileSelPleaseChooseAQuestENGTex.ia8.png b/mm/assets/custom/textures/title_static/gFileSelPleaseChooseAQuestENGTex.ia8.png new file mode 100644 index 000000000..02ca600c2 Binary files /dev/null and b/mm/assets/custom/textures/title_static/gFileSelPleaseChooseAQuestENGTex.ia8.png differ diff --git a/mm/assets/custom/textures/title_static/gFileSelPleaseChooseAQuestFRATex.ia8.png b/mm/assets/custom/textures/title_static/gFileSelPleaseChooseAQuestFRATex.ia8.png new file mode 100644 index 000000000..8bc17292b Binary files /dev/null and b/mm/assets/custom/textures/title_static/gFileSelPleaseChooseAQuestFRATex.ia8.png differ diff --git a/mm/assets/custom/textures/title_static/gFileSelPleaseChooseAQuestGERTex.ia8.png b/mm/assets/custom/textures/title_static/gFileSelPleaseChooseAQuestGERTex.ia8.png new file mode 100644 index 000000000..25f96cc2b Binary files /dev/null and b/mm/assets/custom/textures/title_static/gFileSelPleaseChooseAQuestGERTex.ia8.png differ diff --git a/mm/assets/custom/textures/title_static/gFileSelRANDButtonTex.ia16.png b/mm/assets/custom/textures/title_static/gFileSelRANDButtonTex.ia16.png new file mode 100644 index 000000000..f43114e81 Binary files /dev/null and b/mm/assets/custom/textures/title_static/gFileSelRANDButtonTex.ia16.png differ diff --git a/mm/assets/custom/textures/virtual/gEmptyTexture.rgba32.png b/mm/assets/custom/textures/virtual/gEmptyTexture.rgba32.png new file mode 100644 index 000000000..eaf806b71 Binary files /dev/null and b/mm/assets/custom/textures/virtual/gEmptyTexture.rgba32.png differ diff --git a/mm/build.c b/mm/build.c deleted file mode 100644 index e69de29bb..000000000 diff --git a/mm/include/build.h b/mm/include/build.h index 5099e5d3c..e69975e01 100644 --- a/mm/include/build.h +++ b/mm/include/build.h @@ -1,8 +1,22 @@ #ifndef BUILD_H #define BUILD_H +#include +#ifdef __cplusplus +extern "C" { +#endif +// 2S2H [Port] Version information +extern char gBuildVersion[]; +extern u16 gBuildVersionMajor; +extern u16 gBuildVersionMinor; +extern u16 gBuildVersionPatch; + extern char gBuildTeam[]; extern char gBuildDate[]; extern char gBuildMakeOption[]; +#ifdef __cplusplus +} +#endif + #endif diff --git a/mm/src/boot/build.c b/mm/src/boot/build.c deleted file mode 100644 index 23bd1cd59..000000000 --- a/mm/src/boot/build.c +++ /dev/null @@ -1,3 +0,0 @@ -const char gBuildTeam[] = "zelda@srd44"; -const char gBuildDate[] = "00-07-31 17:04:16"; -const char gBuildMakeOption[] = ""; diff --git a/mm/src/boot/build.c.in b/mm/src/boot/build.c.in index e69de29bb..fedca727f 100644 --- a/mm/src/boot/build.c.in +++ b/mm/src/boot/build.c.in @@ -0,0 +1,11 @@ +#include + +// 2S2H [Port] Version information +const char gBuildVersion[] = "@PROJECT_BUILD_NAME@ (@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@.@CMAKE_PROJECT_VERSION_PATCH@)"; +const u16 gBuildVersionMajor = @CMAKE_PROJECT_VERSION_MAJOR@; +const u16 gBuildVersionMinor = @CMAKE_PROJECT_VERSION_MINOR@; +const u16 gBuildVersionPatch = @CMAKE_PROJECT_VERSION_PATCH@; + +const char gBuildTeam[] = "@PROJECT_TEAM@"; +const char gBuildDate[] = __DATE__ " " __TIME__; +const char gBuildMakeOption[] = ""; diff --git a/mm/src/code/c_keyframe.c b/mm/src/code/c_keyframe.c index d37b28a9b..6ae56e54d 100644 --- a/mm/src/code/c_keyframe.c +++ b/mm/src/code/c_keyframe.c @@ -132,7 +132,7 @@ void Keyframe_InitFlex(KFSkelAnimeFlex* kfSkelAnime, KeyFrameSkeleton* skeleton, skel = (KeyFrameSkeleton*)ResourceMgr_LoadKeyFrameSkelByName(skeleton); } if (ResourceMgr_OTRSigCheck(anim)) { - anim = (KeyFrameSkeleton*)ResourceMgr_LoadKeyFrameSkelByName(animation); + anim = (KeyFrameAnimation*)ResourceMgr_LoadKeyFrameAnimByName(animation); } kfSkelAnime->skeleton = skel;