Get a little metaprogrammy

Use FourCCObject template classes to provide magic type
This commit is contained in:
Lily Tsuru 2022-08-14 14:46:11 -05:00
parent e700c3432d
commit d244d5e3c2
2 changed files with 4 additions and 3 deletions

View File

@ -8,7 +8,8 @@ namespace jmmt {
template <class TMagic, TMagic ValidMagic>
struct BasicStructureWithMagic {
constexpr static TMagic TypeMagic = ValidMagic;
using MagicType = TMagic;
constexpr static MagicType TypeMagic = ValidMagic;
};
template <uint32_t ValidMagic>

View File

@ -22,7 +22,7 @@ namespace jmmt {
};
struct PackageGroup : public FourCCMagic<0x50524750 /* 'PGRP' */> {
uint32_t magic;
MagicType magic;
uint32_t groupNameCrc;
uint32_t fileCount;
@ -30,7 +30,7 @@ namespace jmmt {
};
struct PackageFile : public FourCCMagic<0x4C494650 /* 'PFIL' */> {
uint32_t magic;
MagicType magic;
uint32_t unk[2]; // Don't know what these are?
// Sequence number of the chunk.