added detection of PS4 PKG image (magic is 0x7F434E54)
This commit is contained in:
parent
48af8c75c8
commit
7c552ddb38
|
@ -0,0 +1,24 @@
|
||||||
|
#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;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
enum FileTypes
|
||||||
|
{
|
||||||
|
FILETYPE_UNKNOWN,
|
||||||
|
FILETYPE_PKG
|
||||||
|
};
|
||||||
|
FileTypes detectFileType(const std::string& filepath);
|
|
@ -1,4 +1,6 @@
|
||||||
#include "shadps4gui.h"
|
#include "shadps4gui.h"
|
||||||
|
#include "../emulator/Loader.h"
|
||||||
|
#include <QFileDialog>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
shadps4gui::shadps4gui(QWidget *parent)
|
shadps4gui::shadps4gui(QWidget *parent)
|
||||||
|
@ -17,5 +19,13 @@ shadps4gui::~shadps4gui()
|
||||||
|
|
||||||
void shadps4gui::installPKG()
|
void shadps4gui::installPKG()
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, "PKG ERROR", "Not yet", QMessageBox::Ok, 0);
|
std::string file(QFileDialog::getOpenFileName(this, tr("Install PKG File"), QDir::currentPath(), tr("PKG File (*.PKG)")).toStdString());
|
||||||
|
if (detectFileType(file) == FILETYPE_PKG)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, "PKG ERROR", "File doesn't appear to be a valid PKG file", QMessageBox::Ok, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="core\FsFile.cpp" />
|
<ClCompile Include="core\FsFile.cpp" />
|
||||||
<ClCompile Include="emulator\fileFormat\PSF.cpp" />
|
<ClCompile Include="emulator\fileFormat\PSF.cpp" />
|
||||||
|
<ClCompile Include="emulator\Loader.cpp" />
|
||||||
<ClCompile Include="gui\GameListViewer.cpp" />
|
<ClCompile Include="gui\GameListViewer.cpp" />
|
||||||
<ClCompile Include="gui\shadps4gui.cpp" />
|
<ClCompile Include="gui\shadps4gui.cpp" />
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
|
@ -29,6 +30,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="core\FsFile.h" />
|
<ClInclude Include="core\FsFile.h" />
|
||||||
<ClInclude Include="emulator\fileFormat\PSF.h" />
|
<ClInclude Include="emulator\fileFormat\PSF.h" />
|
||||||
|
<ClInclude Include="emulator\Loader.h" />
|
||||||
<ClInclude Include="Types.h" />
|
<ClInclude Include="Types.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
|
|
|
@ -50,6 +50,9 @@
|
||||||
<ClCompile Include="emulator\fileFormat\PSF.cpp">
|
<ClCompile Include="emulator\fileFormat\PSF.cpp">
|
||||||
<Filter>emulator\fileFormat</Filter>
|
<Filter>emulator\fileFormat</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="emulator\Loader.cpp">
|
||||||
|
<Filter>emulator</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtUic Include="gui\shadps4gui.ui">
|
<QtUic Include="gui\shadps4gui.ui">
|
||||||
|
@ -74,5 +77,8 @@
|
||||||
<ClInclude Include="emulator\fileFormat\PSF.h">
|
<ClInclude Include="emulator\fileFormat\PSF.h">
|
||||||
<Filter>emulator\fileFormat</Filter>
|
<Filter>emulator\fileFormat</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="emulator\Loader.h">
|
||||||
|
<Filter>emulator</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue