COMMON: Switch creator and type in FinderInfo to uint32

This makes it conformant with the MKTAG() macro and makes the usage
more convenient
This commit is contained in:
Eugene Sandulenko
2026-05-17 22:37:35 +02:00
parent be65ca9f3c
commit 19e703bd4f
6 changed files with 22 additions and 22 deletions
+2 -2
View File
@@ -189,8 +189,8 @@ bool StuffItArchive::open(Common::SeekableReadStream *stream, bool flattenTree)
MacFinderInfo finfo;
headStream.read(finfo.type, 4);
headStream.read(finfo.creator, 4);
finfo.type = headStream.readUint32BE();
finfo.creator = headStream.readUint32BE();
finfo.flags = headStream.readUint16BE();
/* uint32 creationDate = */ headStream.readUint32BE();
/* uint32 modificationDate = */ headStream.readUint32BE();
+7 -7
View File
@@ -43,8 +43,8 @@ private:
struct FileDesc {
FileDesc();
byte type[4];
byte creator[4];
uint32 type;
uint32 creator;
uint32 compressedDataSize;
uint32 uncompressedDataSize;
uint32 compressedResSize;
@@ -120,8 +120,8 @@ Common::SeekableReadStream *MacVISEArchive::ArchiveMember::createReadStreamForAl
return nullptr;
Common::MacFinderInfo finfo;
memcpy(finfo.type, _fileDesc->type, 4);
memcpy(finfo.creator, _fileDesc->creator, 4);
finfo.type = _fileDesc->type;
finfo.creator = _fileDesc->creator;
*finfoData = finfo.toData();
@@ -224,7 +224,7 @@ bool MacVISEArchive::ArchiveMember::isInMacArchive() const {
return true;
}
MacVISEArchive::FileDesc::FileDesc() : type{0, 0, 0, 0}, creator{0, 0, 0, 0}, compressedDataSize(0), uncompressedDataSize(0), compressedResSize(0), uncompressedResSize(0), positionInArchive(0) {
MacVISEArchive::FileDesc::FileDesc() : type(0), creator(0), compressedDataSize(0), uncompressedDataSize(0), compressedResSize(0), uncompressedResSize(0), positionInArchive(0) {
}
MacVISEArchive::MacVISEArchive(Common::SeekableReadStream *archiveStream) : _archiveStream(archiveStream) {
@@ -302,8 +302,8 @@ bool MacVISEArchive::loadCatalog() {
}
FileDesc desc;
memcpy(desc.type, fileData + 40, 4);
memcpy(desc.creator, fileData + 44, 4);
desc.type = READ_BE_UINT32(fileData + 40);
desc.creator = READ_BE_UINT32(fileData + 44);
desc.compressedDataSize = READ_BE_UINT32(fileData + 64);
desc.uncompressedDataSize = READ_BE_UINT32(fileData + 68);
desc.compressedResSize = READ_BE_UINT32(fileData + 72);
+7 -7
View File
@@ -37,12 +37,12 @@
namespace Common {
MacFinderInfo::MacFinderInfo() : type{0, 0, 0, 0}, creator{0, 0, 0, 0}, flags(0), position(0, 0), windowID(0) {
MacFinderInfo::MacFinderInfo() : type(0), creator(0), flags(0), position(0, 0), windowID(0) {
}
MacFinderInfo::MacFinderInfo(const MacFinderInfoData &data) {
memcpy(type, data.data + 0, 4);
memcpy(creator, data.data + 4, 4);
type = READ_BE_UINT32(data.data + 0);
creator = READ_BE_UINT32(data.data + 4);
flags = READ_BE_UINT16(data.data + 8);
position.y = READ_BE_INT16(data.data + 10);
position.x = READ_BE_INT16(data.data + 12);
@@ -51,8 +51,8 @@ MacFinderInfo::MacFinderInfo(const MacFinderInfoData &data) {
MacFinderInfoData MacFinderInfo::toData() const {
MacFinderInfoData data;
memcpy(data.data + 0, type, 4);
memcpy(data.data + 4, creator, 4);
WRITE_BE_UINT32(data.data + 0, type);
WRITE_BE_UINT32(data.data + 4, creator);
WRITE_BE_UINT16(data.data + 8, flags);
WRITE_BE_INT16(data.data + 10, position.y);
WRITE_BE_INT16(data.data + 12, position.x);
@@ -651,8 +651,8 @@ bool MacResManager::getFinderInfoFromMacBinary(SeekableReadStream *stream, MacFi
MacFinderInfo finfo;
// Parse fields
memcpy(finfo.type, infoHeader + MBI_TYPE, 4);
memcpy(finfo.creator, infoHeader + MBI_CREATOR, 4);
finfo.type = READ_BE_UINT32(infoHeader + MBI_TYPE);
finfo.creator = READ_BE_UINT32(infoHeader + MBI_CREATOR);
finfo.flags = (infoHeader[MBI_FLAGSHIGH] << 8) + infoHeader[MBI_FLAGSLOW];
finfo.position.x = READ_BE_INT16(infoHeader + MBI_POSX);
finfo.position.y = READ_BE_INT16(infoHeader + MBI_POSY);
+2 -2
View File
@@ -96,8 +96,8 @@ struct MacFinderInfo {
MacFinderInfoData toData() const;
byte type[4];
byte creator[4];
uint32 type;
uint32 creator;
uint16 flags;
Common::Point position;
int16 windowID;
+2 -2
View File
@@ -2583,7 +2583,7 @@ PlayerType evaluateMacPlayer(Common::Archive &fs, Common::ArchiveMember &archive
Common::MacFinderInfo finderInfo;
if (Common::MacResManager::getFileFinderInfo(path, fs, finderInfo)) {
if (finderInfo.type[0] != 'A' || finderInfo.type[1] != 'P' || finderInfo.type[2] != 'P' || finderInfo.type[3] != 'L')
if (finderInfo.type != MKTAG('A', 'P', 'P', 'L'))
return kPlayerTypeNone;
}
@@ -2732,7 +2732,7 @@ bool getMacFileType(Common::Archive &fs, const Common::Path &path, uint32 &outTa
if (!Common::MacResManager::getFileFinderInfo(path, fs, finderInfo))
return false;
outTag = MKTAG(finderInfo.type[0], finderInfo.type[1], finderInfo.type[2], finderInfo.type[3]);
outTag = finderInfo.type;
return true;
}
+2 -2
View File
@@ -104,10 +104,10 @@ ADDetectedGame WageMetaEngineDetection::fallbackDetect(const FileMap &allFiles,
Common::MacFinderInfo finderInfo;
if (resManager.getFileFinderInfo(filePath, finderInfo)) {
if (READ_BE_UINT32(finderInfo.type) != MKTAG('A', 'P', 'P', 'L')) {
if (finderInfo.type != MKTAG('A', 'P', 'P', 'L')) {
continue;
}
if (READ_BE_UINT32(finderInfo.creator) != MKTAG('W', 'E', 'D', 'T')) {
if (finderInfo.creator != MKTAG('W', 'E', 'D', 'T')) {
continue;
}