MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / getFileType

Function getFileType

android/src/rpcsx-android.cpp:285–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283};
284
285static FileType getFileType(const fs::file &file) {
286 file.seek(0);
287 if (PUPHeader pupHeader; file.read(pupHeader)) {
288 if (pupHeader.magic == "SCEUF\0\0\0"_u64) {
289 return FileType::Pup;
290 }
291 }
292
293 file.seek(0);
294 if (PKGHeader pkgHeader; file.read(pkgHeader)) {
295 if (pkgHeader.pkg_magic == std::bit_cast<le_t<u32>>("\x7FPKG"_u32)) {
296 return FileType::Pkg;
297 }
298 }
299
300 file.seek(0);
301 if (NPD_HEADER npdHeader; file.read(npdHeader)) {
302 if (npdHeader.magic == "NPD\0"_u32) {
303 return FileType::Edat;
304 }
305 }
306
307 if (file.size() == 16) {
308 return FileType::Rap;
309 }
310
311 if (iso_dev::open(std::make_unique<file_view_block_dev>(file))) {
312 return FileType::Iso;
313 }
314
315 return FileType::Unknown;
316}
317
318#define MAKE_STRING(id, x) [int(localized_string_id::id)] = {x, U##x}
319

Callers 3

_rpcsx_isInstallableFileFunction · 0.70
_rpcsx_installFunction · 0.70
_rpcsx_installKeyFunction · 0.70

Calls 4

openFunction · 0.85
seekMethod · 0.45
readMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected