FourCCs are light enough to construct on demand

This commit is contained in:
Jack Andersen 2015-08-09 16:03:44 -10:00
parent 310aa10116
commit 99bb5df7f3
5 changed files with 12 additions and 98 deletions

View File

@ -5,47 +5,4 @@ namespace Retro
LogVisor::LogModule LogDNACommon("Retro::DNACommon"); LogVisor::LogModule LogDNACommon("Retro::DNACommon");
const HECL::FourCC ENGL("ENGL");
const HECL::FourCC FREN("FREN");
const HECL::FourCC GERM("GERM");
const HECL::FourCC SPAN("SPAN");
const HECL::FourCC ITAL("ITAL");
const HECL::FourCC JAPN("JAPN");
const HECL::FourCC AFSM("AFSM");
const HECL::FourCC AGSC("AGSC");
const HECL::FourCC ANCS("ANCS");
const HECL::FourCC ANIM("ANIM");
const HECL::FourCC ATBL("ATBL");
const HECL::FourCC CINF("CINF");
const HECL::FourCC CMDL("CMDL");
const HECL::FourCC CRSC("CRSC");
const HECL::FourCC CSKR("CSKR");
const HECL::FourCC CSMP("CSMP");
const HECL::FourCC CSNG("CSNG");
const HECL::FourCC CTWK("CTWK");
const HECL::FourCC DGRP("DGRP");
const HECL::FourCC DPSC("DPSC");
const HECL::FourCC DUMB("DUMB");
const HECL::FourCC ELSC("ELSC");
const HECL::FourCC EVNT("EVNT");
const HECL::FourCC FONT("FONT");
const HECL::FourCC FRME("FRME");
const HECL::FourCC HINT("HINT");
const HECL::FourCC MAPA("MAPA");
const HECL::FourCC MAPU("MAPU");
const HECL::FourCC MAPW("MAPW");
const HECL::FourCC MLVL("MLVL");
const HECL::FourCC MREA("MREA");
const HECL::FourCC PART("PART");
const HECL::FourCC PATH("PATH");
const HECL::FourCC RFRM("RFRM");
const HECL::FourCC ROOM("ROOM");
const HECL::FourCC SAVW("SAVW");
const HECL::FourCC SCAN("SCAN");
const HECL::FourCC STRG("STRG");
const HECL::FourCC SWHC("SWHC");
const HECL::FourCC TXTR("TXTR");
const HECL::FourCC WPSC("WPSC");
} }

View File

@ -26,6 +26,8 @@ public:
: HECL::FourCC() {num = other.toUint32();} : HECL::FourCC() {num = other.toUint32();}
FourCC(const char* name) FourCC(const char* name)
: HECL::FourCC(name) {} : HECL::FourCC(name) {}
FourCC(uint32_t n)
: HECL::FourCC(n) {}
Delete expl; Delete expl;
inline void read(Athena::io::IStreamReader& reader) inline void read(Athena::io::IStreamReader& reader)
@ -470,51 +472,6 @@ public:
/* Resource cooker function */ /* Resource cooker function */
typedef std::function<bool(const HECL::ProjectPath&, const HECL::ProjectPath&)> ResCooker; typedef std::function<bool(const HECL::ProjectPath&, const HECL::ProjectPath&)> ResCooker;
/* Language-identifiers */
extern const HECL::FourCC ENGL;
extern const HECL::FourCC FREN;
extern const HECL::FourCC GERM;
extern const HECL::FourCC SPAN;
extern const HECL::FourCC ITAL;
extern const HECL::FourCC JAPN;
/* Resource types */
extern const HECL::FourCC AFSM;
extern const HECL::FourCC AGSC;
extern const HECL::FourCC ANCS;
extern const HECL::FourCC ANIM;
extern const HECL::FourCC ATBL;
extern const HECL::FourCC CINF;
extern const HECL::FourCC CMDL;
extern const HECL::FourCC CRSC;
extern const HECL::FourCC CSKR;
extern const HECL::FourCC CSMP;
extern const HECL::FourCC CSNG;
extern const HECL::FourCC CTWK;
extern const HECL::FourCC DGRP;
extern const HECL::FourCC DPSC;
extern const HECL::FourCC DUMB;
extern const HECL::FourCC ELSC;
extern const HECL::FourCC EVNT;
extern const HECL::FourCC FONT;
extern const HECL::FourCC FRME;
extern const HECL::FourCC HINT;
extern const HECL::FourCC MAPA;
extern const HECL::FourCC MAPU;
extern const HECL::FourCC MAPW;
extern const HECL::FourCC MLVL;
extern const HECL::FourCC MREA;
extern const HECL::FourCC PART;
extern const HECL::FourCC PATH;
extern const HECL::FourCC RFRM;
extern const HECL::FourCC ROOM;
extern const HECL::FourCC SAVW;
extern const HECL::FourCC SCAN;
extern const HECL::FourCC STRG;
extern const HECL::FourCC SWHC;
extern const HECL::FourCC TXTR;
extern const HECL::FourCC WPSC;
} }
/* Hash template-specializations for UniqueID types */ /* Hash template-specializations for UniqueID types */

View File

@ -23,7 +23,7 @@ PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPar
/* Append Level String */ /* Append Level String */
for (const PAK::Entry& entry : m_pak.m_entries) for (const PAK::Entry& entry : m_pak.m_entries)
{ {
if (entry.type == Retro::MLVL) if (entry.type == SBIG('MLVL'))
{ {
PAKEntryReadStream rs = entry.beginReadStream(m_node); PAKEntryReadStream rs = entry.beginReadStream(m_node);
MLVL mlvl; MLVL mlvl;
@ -36,7 +36,7 @@ PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPar
mlvlName.read(rs); mlvlName.read(rs);
if (m_levelString.size()) if (m_levelString.size())
m_levelString += _S(", "); m_levelString += _S(", ");
m_levelString += mlvlName.getSystemString(ENGL, 0); m_levelString += mlvlName.getSystemString(FourCC(SBIG('ENGL')), 0);
} }
} }
} }
@ -119,7 +119,7 @@ void PAKBridge::build()
/* First pass: build per-area/per-layer dependency map */ /* First pass: build per-area/per-layer dependency map */
for (const PAK::Entry& entry : m_pak.m_entries) for (const PAK::Entry& entry : m_pak.m_entries)
{ {
if (entry.type == Retro::MLVL) if (entry.type == SBIG('MLVL'))
{ {
PAKEntryReadStream rs = entry.beginReadStream(m_node); PAKEntryReadStream rs = entry.beginReadStream(m_node);
MLVL mlvl; MLVL mlvl;
@ -135,7 +135,7 @@ void PAKBridge::build()
STRG areaName; STRG areaName;
PAKEntryReadStream rs = areaNameEnt->beginReadStream(m_node); PAKEntryReadStream rs = areaNameEnt->beginReadStream(m_node);
areaName.read(rs); areaName.read(rs);
areaDeps.name = areaName.getSystemString(Retro::ENGL, 0); areaDeps.name = areaName.getSystemString(FourCC(SBIG('ENGL')), 0);
} }
if (areaDeps.name.empty()) if (areaDeps.name.empty())
{ {

View File

@ -21,7 +21,7 @@ PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPar
/* Append Level String */ /* Append Level String */
for (const DNAMP1::PAK::Entry& entry : m_pak.m_entries) for (const DNAMP1::PAK::Entry& entry : m_pak.m_entries)
{ {
if (entry.type == Retro::MLVL) if (entry.type == SBIG('MLVL'))
{ {
PAKEntryReadStream rs = entry.beginReadStream(m_node); PAKEntryReadStream rs = entry.beginReadStream(m_node);
MLVL mlvl; MLVL mlvl;
@ -34,7 +34,7 @@ PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPar
mlvlName.read(rs); mlvlName.read(rs);
if (m_levelString.size()) if (m_levelString.size())
m_levelString += _S(", "); m_levelString += _S(", ");
m_levelString += mlvlName.getSystemString(ENGL, 0); m_levelString += mlvlName.getSystemString(FourCC(SBIG('ENGL')), 0);
} }
} }
} }
@ -117,7 +117,7 @@ void PAKBridge::build()
/* First pass: build per-area/per-layer dependency map */ /* First pass: build per-area/per-layer dependency map */
for (const DNAMP1::PAK::Entry& entry : m_pak.m_entries) for (const DNAMP1::PAK::Entry& entry : m_pak.m_entries)
{ {
if (entry.type == Retro::MLVL) if (entry.type == SBIG('MLVL'))
{ {
PAKEntryReadStream rs = entry.beginReadStream(m_node); PAKEntryReadStream rs = entry.beginReadStream(m_node);
MLVL mlvl; MLVL mlvl;
@ -133,7 +133,7 @@ void PAKBridge::build()
STRG areaName; STRG areaName;
PAKEntryReadStream rs = areaNameEnt->beginReadStream(m_node); PAKEntryReadStream rs = areaNameEnt->beginReadStream(m_node);
areaName.read(rs); areaName.read(rs);
areaDeps.name = areaName.getSystemString(Retro::ENGL, 0); areaDeps.name = areaName.getSystemString(FourCC(SBIG('ENGL')), 0);
} }
if (areaDeps.name.empty()) if (areaDeps.name.empty())
{ {

View File

@ -24,7 +24,7 @@ PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPar
std::set<HECL::SystemString, CaseInsensitiveCompare> uniq; std::set<HECL::SystemString, CaseInsensitiveCompare> uniq;
for (const PAK::Entry& entry : m_pak.m_entries) for (const PAK::Entry& entry : m_pak.m_entries)
{ {
if (entry.type == Retro::MLVL) if (entry.type == SBIG('MLVL'))
{ {
PAKEntryReadStream rs = entry.beginReadStream(m_node); PAKEntryReadStream rs = entry.beginReadStream(m_node);
MLVL mlvl; MLVL mlvl;
@ -35,7 +35,7 @@ PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPar
PAKEntryReadStream rs = nameEnt->beginReadStream(m_node); PAKEntryReadStream rs = nameEnt->beginReadStream(m_node);
STRG mlvlName; STRG mlvlName;
mlvlName.read(rs); mlvlName.read(rs);
uniq.insert(mlvlName.getSystemString(ENGL, 0)); uniq.insert(mlvlName.getSystemString(FourCC(SBIG('ENGL')), 0));
} }
} }
} }