mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Changes for new LUS resources (#151)
* Changes for new LUS resources * fix factory issues and bump modules * add build version, custom assets folder, and fix extraction * add missing custom assets * fix build .h * libzip in the workflows * apt-deps * Fixes to importers to work with upstream Resource Manager. Also remove duplicated structs. * Bump LUS * bump LUS * Bump LUS * bump lus * point back to louist103/mm --------- Co-authored-by: Adam Bird <archez39@me.com>
This commit is contained in:
committed by
Garrett Cox
co-authored by
Adam Bird
parent
9da273a8ea
commit
904bf60b36
@@ -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
|
||||
@@ -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 }}"
|
||||
|
||||
@@ -56,3 +56,5 @@ mm/libultraship/extern/StrHash64.dir/Debug/StrHash64.tlog/Lib.command.1.tlog
|
||||
/Release
|
||||
.vs/*
|
||||
/x64
|
||||
|
||||
/mm/src/boot/build.c
|
||||
|
||||
+4
-4
@@ -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 $<IF:$<VERSION_LESS:${CMAKE_VERSION},3.17>,remove,rm> -f mm.otr soh.otr
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$<TARGET_FILE:ZAPD>" --non-interactive
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$<TARGET_FILE:ZAPD>" --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="$<TARGET_FILE_DIR:ZAPD>" -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 "$<TARGET_FILE:ZAPD>" --non-interactive --gen-headers
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$<TARGET_FILE:ZAPD>" --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 $<IF:$<VERSION_LESS:${CMAKE_VERSION},3.17>,remove,rm> -f soh.otr
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$<TARGET_FILE:ZAPD>" --norom
|
||||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/OTRExporter/extract_assets.py -z "$<TARGET_FILE:ZAPD>" --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="$<TARGET_FILE_DIR:ZAPD>" -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..."
|
||||
|
||||
+1
-1
Submodule OTRExporter updated: 2e378fe443...5c48f3411c
+1
-1
Submodule ZAPDTR updated: 01ed7e87f2...a406a7d431
+1
-1
Submodule libultraship updated: 87d3a14cb4...e40c19e992
@@ -30,7 +30,6 @@ static const std::unordered_map<int32_t, const char*> textureFilteringMap = {
|
||||
|
||||
static const std::unordered_map<LUS::AudioBackend, const char*> audioBackendsMap = {
|
||||
{ LUS::AudioBackend::WASAPI, "Windows Audio Session API" },
|
||||
{ LUS::AudioBackend::PULSE, "PulseAudio" },
|
||||
{ LUS::AudioBackend::SDL, "SDL" },
|
||||
};
|
||||
|
||||
|
||||
+53
-52
@@ -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<LUS::AnimationFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::SOH_PlayerAnimation, "PlayerAnimation", std::make_shared<LUS::PlayerAnimationFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::SOH_Room, "Room", std::make_shared<LUS::SceneFactory>()); // Is room scene? maybe?
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::SOH_CollisionHeader, "CollisionHeader", std::make_shared<LUS::CollisionHeaderFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::SOH_Skeleton, "Skeleton", std::make_shared<LUS::SkeletonFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::SOH_SkeletonLimb, "SkeletonLimb", std::make_shared<LUS::SkeletonLimbFactory>());
|
||||
// TODO should we use a custom command for this?
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Path, "Path",
|
||||
std::make_shared<LUS::PathFactoryMM>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::SOH_Cutscene, "Cutscene", std::make_shared<LUS::CutsceneFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Text, "Text",
|
||||
std::make_shared<LUS::TextFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_TextMM, "TextMM",
|
||||
std::make_shared<LUS::TextMMFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::SOH_AudioSample, "AudioSample", std::make_shared<LUS::AudioSampleFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::SOH_AudioSoundFont, "AudioSoundFont", std::make_shared<LUS::AudioSoundFontFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::SOH_AudioSequence, "AudioSequence", std::make_shared<LUS::AudioSequenceFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::SOH_Background, "Background", std::make_shared<LUS::BackgroundFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::TSH_TexAnim, "TextureAnimation", std::make_shared<LUS::TextureAnimationFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::TSH_CKeyFrameAnim, "KeyFrameAnim", std::make_shared<LUS::KeyFrameAnimFactory>());
|
||||
context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(
|
||||
LUS::ResourceType::TSH_CKeyFrameSkel, "KeyFrameSkel", std::make_shared<LUS::KeyFrameSkelFactory>());
|
||||
|
||||
auto loader = context->GetResourceManager()->GetResourceLoader();
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAnimationV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Animation", static_cast<uint32_t>(SOH::ResourceType::SOH_Animation), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryPlayerAnimationV0>(),
|
||||
RESOURCE_FORMAT_BINARY, "PlayerAnimation",
|
||||
static_cast<uint32_t>(SOH::ResourceType::SOH_PlayerAnimation), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinarySceneV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Room", static_cast<uint32_t>(SOH::ResourceType::SOH_Room), 0);
|
||||
loader
|
||||
->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryCollisionHeaderV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"CollisionHeader", static_cast<uint32_t>(SOH::ResourceType::SOH_CollisionHeader), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinarySkeletonV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Skeleton", static_cast<uint32_t>(SOH::ResourceType::SOH_Skeleton), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinarySkeletonLimbV0>(),
|
||||
RESOURCE_FORMAT_BINARY, "SkeletonLimb",
|
||||
static_cast<uint32_t>(SOH::ResourceType::SOH_SkeletonLimb), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryPathMMV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Path", static_cast<uint32_t>(SOH::ResourceType::SOH_Path), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryCutsceneV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Cutscene", static_cast<uint32_t>(SOH::ResourceType::SOH_Cutscene), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryTextMMV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"TextMM", static_cast<uint32_t>(SOH::ResourceType::TSH_TextMM), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAudioSampleV2>(), RESOURCE_FORMAT_BINARY,
|
||||
"AudioSample", static_cast<uint32_t>(SOH::ResourceType::SOH_AudioSample), 2);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAudioSoundFontV2>(),
|
||||
RESOURCE_FORMAT_BINARY, "AudioSoundFont",
|
||||
static_cast<uint32_t>(SOH::ResourceType::SOH_AudioSoundFont), 2);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryAudioSequenceV2>(),
|
||||
RESOURCE_FORMAT_BINARY, "AudioSequence", static_cast<uint32_t>(SOH::ResourceType::SOH_AudioSequence), 2);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryBackgroundV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Background", static_cast<uint32_t>(SOH::ResourceType::SOH_Background), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryTextureAnimationV0>(),
|
||||
RESOURCE_FORMAT_BINARY, "TextureAnimation",
|
||||
static_cast<uint32_t>(SOH::ResourceType::TSH_TexAnim), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryKeyFrameAnim>(), RESOURCE_FORMAT_BINARY,
|
||||
"KeyFrameAnim", static_cast<uint32_t>(SOH::ResourceType::TSH_CKeyFrameAnim), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<SOH::ResourceFactoryBinaryKeyFrameSkel>(), RESOURCE_FORMAT_BINARY,
|
||||
"KeyFrameSkel", static_cast<uint32_t>(SOH::ResourceType::TSH_CKeyFrameSkel), 0);
|
||||
context->GetControlDeck()->SetSinglePlayerMappingMode(true);
|
||||
|
||||
//gSaveStateMgr = std::make_shared<SaveStateMgr>();
|
||||
@@ -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<std::string, ExtensionEntry> 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<std::string> 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<uint32_t>(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<uint32_t>(LUS::ResourceType::DisplayList))
|
||||
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
|
||||
else if (res->GetInitData()->Type == LUS::ResourceType::Array)
|
||||
else if (res->GetInitData()->Type == static_cast<uint32_t>(LUS::ResourceType::Array))
|
||||
return (char*)(std::static_pointer_cast<LUS::Array>(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<uint32_t>(LUS::ResourceType::DisplayList))
|
||||
return (char*)&((std::static_pointer_cast<LUS::DisplayList>(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<LUS::PlayerAnimation>(GetResourceByNameHandlingMQ(animPath));
|
||||
auto anim = std::static_pointer_cast<SOH::PlayerAnimation>(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) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Extract.h"
|
||||
#include "portable-file-dialogs.h"
|
||||
#include <Utils/BitConverter.h>
|
||||
#include "build.h"
|
||||
|
||||
#ifdef unix
|
||||
#include <dirent.h>
|
||||
@@ -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<const char*, argc> 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());
|
||||
|
||||
@@ -4,32 +4,15 @@
|
||||
#include <libultraship/libultraship.h>
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
AnimationFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<Animation>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<AnimationFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Animation with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource>
|
||||
ResourceFactoryBinaryAnimationV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<Animation> animation = std::static_pointer_cast<Animation>(resource);
|
||||
|
||||
ResourceVersionFactory::ParseFileBinary(reader, animation);
|
||||
auto animation = std::make_shared<Animation>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
AnimationType animType = (AnimationType)reader->ReadUInt32();
|
||||
animation->type = animType;
|
||||
@@ -99,10 +82,12 @@ void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> 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<Animation>(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
|
||||
|
||||
@@ -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<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
};
|
||||
|
||||
class AnimationFactoryV0 : public ResourceVersionFactory {
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
|
||||
@@ -2,33 +2,14 @@
|
||||
#include "2s2h/resource/type/AudioSample.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
AudioSampleFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<AudioSample>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSampleFactoryV0>();
|
||||
break;
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSampleV2::ReadResource(std::shared_ptr<LUS::File> 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<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource)
|
||||
{
|
||||
std::shared_ptr<AudioSample> audioSample = std::static_pointer_cast<AudioSample>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSample);
|
||||
auto audioSample = std::make_shared<AudioSample>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
audioSample->sample.codec = reader->ReadUByte();
|
||||
audioSample->sample.medium = reader->ReadUByte();
|
||||
@@ -65,9 +46,10 @@ void LUS::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> 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
|
||||
|
||||
@@ -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<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class AudioSampleFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
||||
@@ -2,33 +2,14 @@
|
||||
#include "2s2h/resource/type/AudioSequence.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
AudioSequenceFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<AudioSequence>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSequenceFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<AudioSequence> audioSequence = std::static_pointer_cast<AudioSequence>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSequence);
|
||||
auto audioSequence = std::make_shared<AudioSequence>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
audioSequence->sequence.seqDataSize = reader->ReadInt32();
|
||||
audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize);
|
||||
@@ -48,5 +29,7 @@ void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
||||
for (uint32_t i = 0; i < audioSequence->sequence.numFonts; i++) {
|
||||
audioSequence->sequence.fonts[i] = reader->ReadUByte();
|
||||
}
|
||||
|
||||
return audioSequence;
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
||||
@@ -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<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class AudioSequenceFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
||||
@@ -3,33 +3,14 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "libultraship/libultraship.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
AudioSoundFontFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<AudioSoundFont>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 2:
|
||||
factory = std::make_shared<AudioSoundFontFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr)
|
||||
{
|
||||
SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<AudioSoundFont> audioSoundFont = std::static_pointer_cast<AudioSoundFont>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont);
|
||||
auto audioSoundFont = std::make_shared<AudioSoundFont>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
audioSoundFont->soundFont.fntIndex = reader->ReadInt32();
|
||||
audioSoundFont->medium = reader->ReadInt8();
|
||||
@@ -186,5 +167,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader>
|
||||
audioSoundFont->soundEffects.push_back(soundEffect);
|
||||
}
|
||||
audioSoundFont->soundFont.soundEffects = audioSoundFont->soundEffects.data();
|
||||
|
||||
return audioSoundFont;
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
||||
@@ -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<IResource>
|
||||
ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) override;
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
|
||||
class AudioSoundFontFactoryV0 : public ResourceVersionFactory
|
||||
{
|
||||
public:
|
||||
void ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) override;
|
||||
};
|
||||
}; // namespace LUS
|
||||
} // namespace SOH
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
#include "ResourceFactoryBinary.h"
|
||||
|
||||
namespace SOH {
|
||||
class ResourceFactoryBinaryAudioSoundFontV2 : public LUS::ResourceFactoryBinary {
|
||||
public:
|
||||
std::shared_ptr<LUS::IResource> ReadResource(std::shared_ptr<LUS::File> file) override;
|
||||
};
|
||||
} // namespace SOH
|
||||
@@ -2,31 +2,14 @@
|
||||
#include "2s2h/resource/type/Background.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace LUS {
|
||||
std::shared_ptr<IResource>
|
||||
BackgroundFactory::ReadResource(std::shared_ptr<ResourceInitData> initData, std::shared_ptr<BinaryReader> reader) {
|
||||
auto resource = std::make_shared<Background>(initData);
|
||||
std::shared_ptr<ResourceVersionFactory> factory = nullptr;
|
||||
|
||||
switch (resource->GetInitData()->ResourceVersion) {
|
||||
case 0:
|
||||
factory = std::make_shared<BackgroundFactoryV0>();
|
||||
break;
|
||||
}
|
||||
|
||||
if (factory == nullptr) {
|
||||
SPDLOG_ERROR("Failed to load Background with version {}", resource->GetInitData()->ResourceVersion);
|
||||
namespace SOH {
|
||||
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryBackgroundV0::ReadResource(std::shared_ptr<LUS::File> file) {
|
||||
if (!FileHasValidFormatAndReader(file)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
factory->ParseFileBinary(reader, resource);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader, std::shared_ptr<IResource> resource) {
|
||||
std::shared_ptr<Background> background = std::static_pointer_cast<Background>(resource);
|
||||
ResourceVersionFactory::ParseFileBinary(reader, background);
|
||||
auto background = std::make_shared<Background>(file->InitData);
|
||||
auto reader = std::get<std::shared_ptr<LUS::BinaryReader>>(file->Reader);
|
||||
|
||||
uint32_t dataSize = reader->ReadUInt32();
|
||||
|
||||
@@ -35,5 +18,7 @@ void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr<BinaryReader> reader,
|
||||
for (uint32_t i = 0; i < dataSize; i++) {
|
||||
background->Data.push_back(reader->ReadUByte());
|
||||
}
|
||||
|
||||
return background;
|
||||
}
|
||||
} // namespace LUS
|
||||
} // namespace SOH
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user