2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 21:07:42 +00:00

various implementation

This commit is contained in:
Jack Andersen
2015-08-22 20:42:29 -10:00
parent 6577d4ca13
commit f3b5b9f49a
45 changed files with 580 additions and 84 deletions

View File

@@ -79,7 +79,7 @@ struct MaterialSet : BigDNA
XRAY = SBIG('XRAY'),
TOON = SBIG('TOON')
};
FourCC subtype;
DNAFourCC subtype;
struct Flags : BigDNA
{
DECL_DNA
@@ -106,7 +106,7 @@ struct MaterialSet : BigDNA
CLR = SBIG('CLR '),
DIFB = SBIG('DIFB')
};
FourCC subtype;
DNAFourCC subtype;
GX::Color color;
};
struct SectionINT : ISection
@@ -121,7 +121,7 @@ struct MaterialSet : BigDNA
BNIF = SBIG('BNIF'),
XRBR = SBIG('XRBR')
};
FourCC subtype;
DNAFourCC subtype;
Value<atUint32> value;
};
struct SectionFactory : BigDNA
@@ -130,7 +130,7 @@ struct MaterialSet : BigDNA
std::unique_ptr<ISection> section;
void read(Athena::io::IStreamReader& reader)
{
FourCC type;
DNAFourCC type;
type.read(reader);
switch (type)
{

View File

@@ -24,7 +24,7 @@ PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPar
std::set<HECL::SystemString, CaseInsensitiveCompare> uniq;
for (const PAK::Entry& entry : m_pak.m_entries)
{
if (entry.type == SBIG('MLVL'))
if (entry.type == FOURCC('MLVL'))
{
PAKEntryReadStream rs = entry.beginReadStream(m_node);
MLVL mlvl;

View File

@@ -62,7 +62,7 @@ void PAK::write(Athena::io::IStreamWriter& writer) const
{
m_header.write(writer);
FourCC("STRG").write(writer);
DNAFourCC("STRG").write(writer);
atUint32 strgSz = 4;
for (const NameEntry& entry : m_nameEntries)
strgSz += (atUint32)entry.name.size() + 13;
@@ -70,14 +70,14 @@ void PAK::write(Athena::io::IStreamWriter& writer) const
strgSz += strgPad;
writer.writeUint32Big(strgSz);
FourCC("RSHD").write(writer);
DNAFourCC("RSHD").write(writer);
atUint32 rshdSz = 4 + 24 * m_entries.size();
atUint32 rshdPad = ((rshdSz + 63) & ~63) - rshdSz;
rshdSz += rshdPad;
writer.writeUint32Big(rshdSz);
atUint32 dataOffset = 128 + strgSz + rshdSz;
FourCC("DATA").write(writer);
DNAFourCC("DATA").write(writer);
atUint32 dataSz = 0;
for (const Entry& entry : m_entries)
dataSz += (entry.size + 63) & ~63;

View File

@@ -29,7 +29,7 @@ struct PAK : BigDNA
{
DECL_DNA
String<-1> name;
FourCC type;
DNAFourCC type;
UniqueID64 id;
};
@@ -37,7 +37,7 @@ struct PAK : BigDNA
{
DECL_DNA
Value<atUint32> compressed;
FourCC type;
DNAFourCC type;
UniqueID64 id;
Value<atUint32> size;
Value<atUint32> offset;

View File

@@ -29,11 +29,11 @@ void STRG::_read(Athena::io::IStreamReader& reader)
}
}
std::vector<FourCC> readLangs;
std::vector<DNAFourCC> readLangs;
readLangs.reserve(langCount);
for (atUint32 l=0 ; l<langCount ; ++l)
{
FourCC lang;
DNAFourCC lang;
lang.read(reader);
readLangs.emplace_back(lang);
}
@@ -62,7 +62,7 @@ void STRG::_read(Athena::io::IStreamReader& reader)
langMap.clear();
langMap.reserve(langCount);
for (std::pair<FourCC, std::vector<std::string>>& item : langs)
for (std::pair<DNAFourCC, std::vector<std::string>>& item : langs)
langMap.emplace(item.first, &item.second);
}
@@ -142,12 +142,12 @@ void STRG::fromYAML(Athena::io::YAMLDocReader& reader)
for (const auto& node : item.second->m_seqChildren)
if (node->m_type == YAML_SCALAR_NODE)
strs.emplace_back(node->m_scalarString);
langs.emplace_back(std::make_pair(FourCC(item.first.c_str()), std::move(strs)));
langs.emplace_back(std::make_pair(DNAFourCC(item.first.c_str()), std::move(strs)));
}
langMap.clear();
langMap.reserve(langs.size());
for (std::pair<FourCC, std::vector<std::string>>& item : langs)
for (std::pair<DNAFourCC, std::vector<std::string>>& item : langs)
langMap.emplace(item.first, &item.second);
}

View File

@@ -15,8 +15,8 @@ struct STRG : ISTRG
DECL_YAML
Delete expl;
void _read(Athena::io::IStreamReader& reader);
std::vector<std::pair<FourCC, std::vector<std::string>>> langs;
std::unordered_map<FourCC, std::vector<std::string>*> langMap;
std::vector<std::pair<DNAFourCC, std::vector<std::string>>> langs;
std::unordered_map<DNAFourCC, std::vector<std::string>*> langMap;
std::map<std::string, int32_t> names;
inline int32_t lookupIdx(const std::string& name) const