Add ability to load tweaks

This commit is contained in:
Phillip Stephens 2016-08-31 14:00:06 -07:00
parent d104c7eb45
commit 955d043c9e
4 changed files with 15 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#include "../DNACommon/Tweaks/TweakWriter.hpp" #include "../DNACommon/Tweaks/TweakWriter.hpp"
#include "Tweaks/CTweakPlayerRes.hpp" #include "Tweaks/CTweakPlayerRes.hpp"
#include "Tweaks/CTweakGunRes.hpp"
namespace DataSpec namespace DataSpec
{ {
@ -323,6 +324,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
{ {
if (!name.compare("PlayerRes")) if (!name.compare("PlayerRes"))
return {ExtractTweak<CTweakPlayerRes>, nullptr, {_S(".yaml")}}; return {ExtractTweak<CTweakPlayerRes>, nullptr, {_S(".yaml")}};
if (!name.compare("GunRes"))
return {ExtractTweak<CTweakGunRes>, nullptr, {_S(".yaml")}};
} }
break; break;
} }

View File

@ -20,6 +20,7 @@
#include "DNACommon/DGRP.hpp" #include "DNACommon/DGRP.hpp"
#include "DNACommon/Tweaks/TweakWriter.hpp" #include "DNACommon/Tweaks/TweakWriter.hpp"
#include "DNAMP1/Tweaks/CTweakPlayerRes.hpp" #include "DNAMP1/Tweaks/CTweakPlayerRes.hpp"
#include "DNAMP1/Tweaks/CTweakGunRes.hpp"
#include "hecl/ClientProcess.hpp" #include "hecl/ClientProcess.hpp"
@ -350,6 +351,8 @@ struct SpecMP1 : SpecBase
return true; return true;
else if (!strcmp(classType, DNAMP1::CTweakPlayerRes::DNAType())) else if (!strcmp(classType, DNAMP1::CTweakPlayerRes::DNAType()))
return true; return true;
else if (!strcmp(classType, DNAMP1::CTweakGunRes::DNAType()))
return true;
return false; return false;
}); });
} }
@ -495,6 +498,12 @@ struct SpecMP1 : SpecBase
playerRes.read(reader); playerRes.read(reader);
WriteTweak(playerRes, out); WriteTweak(playerRes, out);
} }
else if (!classStr.compare(DNAMP1::CTweakGunRes::DNAType()))
{
DNAMP1::CTweakGunRes gunRes;
gunRes.read(reader);
WriteTweak(gunRes, out);
}
} }
progress(_S("Done")); progress(_S("Done"));
} }

View File

@ -138,7 +138,8 @@ SObjectTag ProjectResourceFactoryMP1::TagFromPath(const hecl::ProjectPath& path,
resTag.type = SBIG('STRG'); resTag.type = SBIG('STRG');
return true; return true;
} }
else if (!strcmp(className, "DataSpec::DNAMP1::CTweakPlayerRes")) else if (!strcmp(className, "DataSpec::DNAMP1::CTweakPlayerRes") ||
!strcmp(className, "DataSpec::DNAMP1::CTweakGunRes"))
{ {
resTag.type = SBIG('CTWK'); resTag.type = SBIG('CTWK');
return true; return true;

View File

@ -77,6 +77,7 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr,
InitializeSubsystems(storeMgr, voiceEngine); InitializeSubsystems(storeMgr, voiceEngine);
x128_globalObjects.PostInitialize(); x128_globalObjects.PostInitialize();
x70_tweaks.RegisterTweaks(); x70_tweaks.RegisterTweaks();
x70_tweaks.RegisterResourceTweaks();
//g_TweakManager->ReadFromMemoryCard("AudioTweaks"); //g_TweakManager->ReadFromMemoryCard("AudioTweaks");
FillInAssetIDs(); FillInAssetIDs();
} }