DGRP Fixes

This commit is contained in:
Phillip Stephens 2016-04-12 04:37:07 -07:00
parent 497ad50fa6
commit 14e0468adf
10 changed files with 99 additions and 5 deletions

View File

@ -5,6 +5,8 @@
namespace DataSpec namespace DataSpec
{ {
namespace DNADGRP
{
template <class IDType> template <class IDType>
void DGRP<IDType>::read(athena::io::IStreamReader& __dna_reader) void DGRP<IDType>::read(athena::io::IStreamReader& __dna_reader)
{ {
@ -137,5 +139,5 @@ bool WriteDGRP(const DGRP<IDType>& dgrp, const hecl::ProjectPath& outPath)
} }
template bool WriteDGRP<UniqueID32>(const DGRP<UniqueID32>& dgrp, const hecl::ProjectPath& outPath); template bool WriteDGRP<UniqueID32>(const DGRP<UniqueID32>& dgrp, const hecl::ProjectPath& outPath);
template bool WriteDGRP<UniqueID64>(const DGRP<UniqueID64>& dgrp, const hecl::ProjectPath& outPath); template bool WriteDGRP<UniqueID64>(const DGRP<UniqueID64>& dgrp, const hecl::ProjectPath& outPath);
}
} }

View File

@ -0,0 +1,33 @@
#ifndef __COMMON_DGRP_HPP__
#define __COMMON_DGRP_HPP__
#include "DNACommon.hpp"
#include "PAK.hpp"
namespace DataSpec
{
namespace DNADGRP
{
template <class IDType>
struct DGRP : BigYAML
{
DECL_YAML
Value<atUint32> dependCount;
struct ObjectTag : BigYAML
{
DECL_YAML
DNAFourCC type;
UniqueID32 id;
};
Vector<ObjectTag, DNA_COUNT(dependCount)> depends;
};
template <class IDType>
bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteDGRP(const DGRP<IDType>& dgrp, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_DGRP_HPP__

View File

@ -308,7 +308,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK::Entry& entry)
case SBIG('FONT'): case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID32>, nullptr, {_S(".yaml")}}; return {DNAFont::ExtractFONT<UniqueID32>, nullptr, {_S(".yaml")}};
case SBIG('DGRP'): case SBIG('DGRP'):
return {ExtractDGRP<UniqueID32>, nullptr, {_S(".yaml")}}; return {DNADGRP::ExtractDGRP<UniqueID32>, nullptr, {_S(".yaml")}};
} }
return {}; return {};
} }

View File

@ -237,7 +237,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const DNAMP1::PAK::Entry& ent
case SBIG('FONT'): case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID32>, nullptr, {_S(".yaml")}}; return {DNAFont::ExtractFONT<UniqueID32>, nullptr, {_S(".yaml")}};
case SBIG('DGRP'): case SBIG('DGRP'):
return {ExtractDGRP<UniqueID32>, nullptr, {_S(".yaml")}}; return {DNADGRP::ExtractDGRP<UniqueID32>, nullptr, {_S(".yaml")}};
} }
return {}; return {};
} }

View File

@ -245,7 +245,7 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK::Entry& entry)
case SBIG('FONT'): case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID64>, nullptr, {_S(".yaml")}}; return {DNAFont::ExtractFONT<UniqueID64>, nullptr, {_S(".yaml")}};
case SBIG('DGRP'): case SBIG('DGRP'):
return {ExtractDGRP<UniqueID64>, nullptr, {_S(".yaml")}}; return {DNADGRP::ExtractDGRP<UniqueID64>, nullptr, {_S(".yaml")}};
} }
return {}; return {};
} }

View File

@ -15,6 +15,7 @@
#include "DNACommon/WPSC.hpp" #include "DNACommon/WPSC.hpp"
#include "DNACommon/CRSC.hpp" #include "DNACommon/CRSC.hpp"
#include "DNACommon/DPSC.hpp" #include "DNACommon/DPSC.hpp"
#include "DNACommon/DGRP.hpp"
#include "hecl/ClientProcess.hpp" #include "hecl/ClientProcess.hpp"
@ -339,6 +340,8 @@ struct SpecMP1 : SpecBase
return true; return true;
else if (!strcmp(classType, DNAParticle::DPSM<UniqueID32>::DNAType())) else if (!strcmp(classType, DNAParticle::DPSM<UniqueID32>::DNAType()))
return true; return true;
else if (!strcmp(classType, DNADGRP::DGRP<UniqueID32>::DNAType()))
return true;
return false; return false;
}); });
} }
@ -436,6 +439,12 @@ struct SpecMP1 : SpecBase
dpsm.read(reader); dpsm.read(reader);
DNAParticle::WriteDPSM(dpsm, out); DNAParticle::WriteDPSM(dpsm, out);
} }
else if (!classStr.compare(DNADGRP::DGRP<UniqueID32>::DNAType()))
{
DNADGRP::DGRP<UniqueID32> dgrp;
dgrp.read(reader);
DNADGRP::WriteDGRP(dgrp, out);
}
} }
progress(_S("Done")); progress(_S("Done"));
} }

View File

@ -13,7 +13,7 @@
#include "Runtime/Character/CAnimCharacterSet.hpp" #include "Runtime/Character/CAnimCharacterSet.hpp"
#include "Runtime/Character/CAllFormatsAnimSource.hpp" #include "Runtime/Character/CAllFormatsAnimSource.hpp"
#include "Runtime/Character/CAnimPOIData.hpp" #include "Runtime/Character/CAnimPOIData.hpp"
#include "Runtime/CDependencyGroup.hpp"
#include "DataSpec/DNACommon/TXTR.hpp" #include "DataSpec/DNACommon/TXTR.hpp"
namespace DataSpec namespace DataSpec
@ -37,6 +37,7 @@ ProjectResourceFactoryMP1::ProjectResourceFactoryMP1(hecl::ClientProcess& client
m_factoryMgr.AddFactory(FOURCC('ANCS'), FFactoryFunc(FAnimCharacterSet)); m_factoryMgr.AddFactory(FOURCC('ANCS'), FFactoryFunc(FAnimCharacterSet));
m_factoryMgr.AddFactory(FOURCC('ANIM'), FFactoryFunc(AnimSourceFactory)); m_factoryMgr.AddFactory(FOURCC('ANIM'), FFactoryFunc(AnimSourceFactory));
m_factoryMgr.AddFactory(FOURCC('EVNT'), FFactoryFunc(AnimPOIDataFactory)); m_factoryMgr.AddFactory(FOURCC('EVNT'), FFactoryFunc(AnimPOIDataFactory));
m_factoryMgr.AddFactory(FOURCC('DGRP'), FFactoryFunc(FDependencyGroupFactory));
} }
void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj) void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj)
@ -111,6 +112,11 @@ SObjectTag ProjectResourceFactoryMP1::TagFromPath(const hecl::ProjectPath& path,
resTag.type = SBIG('EVNT'); resTag.type = SBIG('EVNT');
return true; return true;
} }
else if (!strcmp(className, "urde::DGRP"))
{
resTag.type = SBIG('DGRP');
return true;
}
return false; return false;
})) }))
{ {

View File

@ -0,0 +1,24 @@
#include "CDependencyGroup.hpp"
#include "CToken.hpp"
namespace urde
{
CDependencyGroup::CDependencyGroup(CInputStream& in)
{
ReadFromStream(in);
}
void CDependencyGroup::ReadFromStream(CInputStream& in)
{
u32 depCount = in.readUint32Big();
x0_objectTags.reserve(depCount);
for (u32 i = 0 ; i < depCount ; i++)
x0_objectTags.emplace_back(in);
}
CFactoryFnReturn FDependencyGroupFactory(const SObjectTag& /*tag*/, CInputStream& in, const CVParamTransfer& /*param*/)
{
return TToken<CDependencyGroup>::GetIObjObjectFor(std::unique_ptr<CDependencyGroup>(new CDependencyGroup(in)));
}
}

View File

@ -0,0 +1,19 @@
#ifndef CDEPENDENCYGROUP_HPP
#define CDEPENDENCYGROUP_HPP
#include "CFactoryMgr.hpp"
namespace urde
{
class CDependencyGroup
{
std::vector<SObjectTag> x0_objectTags;
public:
CDependencyGroup(CInputStream& in);
void ReadFromStream(CInputStream& in);
};
CFactoryFnReturn FDependencyGroupFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param);
}
#endif // CDEPENDENCYGROUP_HPP

View File

@ -22,6 +22,7 @@ add_library(RuntimeCommon
IAllocator.hpp IAllocator.cpp IAllocator.hpp IAllocator.cpp
CGameAllocator.hpp CGameAllocator.cpp CGameAllocator.hpp CGameAllocator.cpp
CPathFindArea.hpp CPathFindArea.cpp CPathFindArea.hpp CPathFindArea.cpp
CDependencyGroup.hpp CDependencyGroup.cpp
CBasics.hpp CBasicsPC.cpp CBasics.hpp CBasicsPC.cpp
CIOWin.hpp CIOWin.hpp
CIOWinManager.hpp CIOWinManager.cpp CIOWinManager.hpp CIOWinManager.cpp