mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-22 10:04:39 +00:00
25 lines
454 B
C++
25 lines
454 B
C++
#include "Loader.h"
|
|
#include "../core/FsFile.h"
|
|
|
|
FileTypes detectFileType(const std::string& filepath)
|
|
{
|
|
if (filepath.size() == 0)//no file loaded
|
|
{
|
|
return FILETYPE_UNKNOWN;
|
|
}
|
|
FsFile file;
|
|
file.Open(filepath, fsRead);
|
|
file.Seek(0, fsSeekSet);
|
|
U32 magic;
|
|
file.Read(&magic, sizeof(magic));
|
|
file.Close();
|
|
ReadBE(magic);//magic is BE make it LE
|
|
switch (magic)
|
|
{
|
|
case 0x7F434E54://PS4 PKG
|
|
return FILETYPE_PKG;
|
|
}
|
|
return FILETYPE_UNKNOWN;
|
|
|
|
}
|