mirror of
https://github.com/zeldaret/ss
synced 2026-06-02 10:10:13 -04:00
ut_binaryFileFormat Matching
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#include <nw4r/ut/ut_binaryFileFormat.h>
|
||||
|
||||
namespace nw4r {
|
||||
namespace ut {
|
||||
|
||||
/* 8042a9e0 */
|
||||
bool IsValidBinaryFile(const BinaryFileHeader *header, unsigned long magic, u16 version, u16 numBlocks) {
|
||||
if (header->magic != magic) {
|
||||
return false;
|
||||
}
|
||||
if (header->byteOrder != 0xFEFF) {
|
||||
return false;
|
||||
}
|
||||
if (header->version != version) {
|
||||
return false;
|
||||
}
|
||||
if (header->fileSize < (numBlocks * sizeof(BinaryBlockHeader) + sizeof(BinaryFileHeader))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (header->numBlocks < numBlocks) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace ut
|
||||
} // namespace nw4r
|
||||
Reference in New Issue
Block a user