diff --git a/include/romfs_dev.h b/include/romfs_dev.h index 39bbed0..6f555a6 100644 --- a/include/romfs_dev.h +++ b/include/romfs_dev.h @@ -13,7 +13,8 @@ /// RomFS header. typedef struct { - uint64_t headerSize; ///< Size of the header. + uint32_t headerMagic; ///< Magic value. + uint32_t headerSize; ///< Size of the header. uint64_t dirHashTableOff; ///< Offset of the directory hash table. uint64_t dirHashTableSize; ///< Size of the directory hash table. uint64_t dirTableOff; ///< Offset of the directory table. diff --git a/source/romfs_dev.c b/source/romfs_dev.c index 8e90f70..35e8242 100644 --- a/source/romfs_dev.c +++ b/source/romfs_dev.c @@ -286,6 +286,10 @@ int32_t romfsMountCommon(const char *name, romfs_mount *mount) { goto fail_io; } + if (memcmp(&mount->header.headerMagic, "WUHB", sizeof(mount->header.headerMagic)) != 0) { + goto fail_io; + } + if (mount->header.headerSize != 0x50) { goto fail_io; }