mirror of
https://github.com/zeldaret/ss
synced 2026-06-21 16:16:44 -04:00
Merge branch 'main' of https://github.com/lepelog/ss-dtk
This commit is contained in:
@@ -222,6 +222,9 @@ nw4r/ut/ut_TextWriterBase.cpp:
|
||||
.text start:0x8042EF20 end:0x80434294
|
||||
.ctors start:0x804DB950 end:0x804DB954
|
||||
|
||||
nw4r/ut/ut_binaryFileFormat.cpp:
|
||||
.text start:0x8042A9E0 end:0x8042AA54
|
||||
|
||||
nw4r/db/db_directPrint.cpp:
|
||||
.text start:0x804342A0 end:0x80434E9C
|
||||
.rodata start:0x804F5D28 end:0x804F5FDC
|
||||
|
||||
@@ -333,6 +333,7 @@ config.libs = [
|
||||
Object(NonMatching, "nw4r/ut/ut_ResFont.cpp"),
|
||||
Object(NonMatching, "nw4r/ut/ut_CharWriter.cpp"),
|
||||
Object(NonMatching, "nw4r/ut/ut_TextWriterBase.cpp"),
|
||||
Object(Matching, "nw4r/ut/ut_binaryFileFormat.cpp"),
|
||||
],
|
||||
),
|
||||
# EGG
|
||||
|
||||
@@ -19,8 +19,7 @@ struct BinaryFileHeader {
|
||||
u16 numBlocks; // at 0xE
|
||||
};
|
||||
|
||||
bool IsValidBinaryFile(const BinaryFileHeader* header, u32 magic, u16 version,
|
||||
u16 numBlocks);
|
||||
bool IsValidBinaryFile(const BinaryFileHeader *header, unsigned long magic, u16 version, u16 numBlocks);
|
||||
|
||||
} // namespace ut
|
||||
} // namespace nw4r
|
||||
|
||||
@@ -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