Skip to content

Commit c77edd5

Browse files
committed
Add more guessable file types
1 parent 5b499d3 commit c77edd5

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

common/src/filetypes.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ const static QMap<std::array<uint8_t, 4>, FileType> magicToType{
135135
{{0x45, 0x4E, 0x56, 0x42}, FileType::EnvironmentBinary},
136136
{{0x4F, 0x42, 0x53, 0x42}, FileType::ObjectBehaviorSetBinary},
137137
{{0x62, 0x6C, 0x6B, 0x73}, FileType::Skeleton},
138+
{{0x45, 0x58, 0x44, 0x46}, FileType::ExcelData},
139+
{{0x45, 0x58, 0x48, 0x46}, FileType::ExcelHeader},
140+
{{0x53, 0x68, 0x43, 0x64}, FileType::Shader},
141+
{{0x53, 0x68, 0x50, 0x6B}, FileType::ShaderPackage},
142+
{{0x1B, 0x4C, 0x75, 0x61}, FileType::LuaBytecode},
143+
};
144+
145+
const static QMap<std::array<uint8_t, 2>, FileType> shortMagicToType{
146+
{{0x4D, 0x53}, FileType::StainingTemplate},
138147
};
139148

140149
FileType FileTypes::getFileType(const QString &extension)
@@ -178,6 +187,12 @@ FileType FileTypes::guessFileType(physis_Buffer buffer)
178187
if (magicToType.contains(magic)) {
179188
return magicToType[magic];
180189
}
190+
191+
std::array<uint8_t, 2> shortMagic{};
192+
std::memcpy(shortMagic.data(), magic.data(), 2);
193+
if (shortMagicToType.contains(shortMagic)) {
194+
return shortMagicToType[shortMagic];
195+
}
181196
}
182197
return FileType::Unknown;
183198
}

0 commit comments

Comments
 (0)