Skip to content

Commit

Permalink
TROPUSR: Check header magic
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Mar 13, 2021
1 parent 9e1aa25 commit 0c4d06a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rpcs3/Loader/TROPUSR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

LOG_CHANNEL(trp_log, "Trophy");

enum : u32
{
TROPUSR_MAGIC = 0x818F54AD
};

bool TROPUSRLoader::Load(const std::string& filepath, const std::string& configpath)
{
const std::string& path = vfs::get(filepath);
Expand Down Expand Up @@ -38,7 +43,7 @@ bool TROPUSRLoader::LoadHeader()

m_file.seek(0);

if (!m_file.read(m_header))
if (!m_file.read(m_header) || m_header.magic != TROPUSR_MAGIC)
{
return false;
}
Expand Down Expand Up @@ -175,7 +180,7 @@ bool TROPUSRLoader::Generate(const std::string& filepath, const std::string& con
m_tableHeaders.push_back(table6header);

std::memset(&m_header, 0, sizeof(m_header));
m_header.magic = 0x818F54AD;
m_header.magic = TROPUSR_MAGIC;
m_header.unk1 = 0x00010000;
m_header.tables_count = ::size32(m_tableHeaders);
m_header.unk2 = 0;
Expand Down

0 comments on commit 0c4d06a

Please sign in to comment.