mirror of
https://github.com/zeldaret/ss
synced 2026-06-01 17:57:39 -04:00
29 lines
644 B
C++
29 lines
644 B
C++
#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
|