From d244d5e3c2d1c2b8fc6f9494a2fb85248b02b023 Mon Sep 17 00:00:00 2001 From: modeco80 Date: Sun, 14 Aug 2022 14:46:11 -0500 Subject: [PATCH] Get a little metaprogrammy Use FourCCObject template classes to provide magic type --- include/jmmt/FourCCObject.h | 3 ++- include/jmmt/package.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/jmmt/FourCCObject.h b/include/jmmt/FourCCObject.h index 26de829..7457c2d 100644 --- a/include/jmmt/FourCCObject.h +++ b/include/jmmt/FourCCObject.h @@ -8,7 +8,8 @@ namespace jmmt { template struct BasicStructureWithMagic { - constexpr static TMagic TypeMagic = ValidMagic; + using MagicType = TMagic; + constexpr static MagicType TypeMagic = ValidMagic; }; template diff --git a/include/jmmt/package.h b/include/jmmt/package.h index 294a7ab..f3c52d6 100644 --- a/include/jmmt/package.h +++ b/include/jmmt/package.h @@ -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.