Skip to content

Commit

Permalink
Atomic trophy status updates
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Mar 2, 2021
1 parent ea5e837 commit 0885f1e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions rpcs3/Loader/TROPUSR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,30 +107,31 @@ bool TROPUSRLoader::LoadTables()
// TODO: TROPUSRLoader::Save deletes the TROPUSR and creates it again. This is probably very slow.
bool TROPUSRLoader::Save(const std::string& filepath)
{
if (!m_file.open(vfs::get(filepath), fs::rewrite))
fs::pending_file temp(vfs::get(filepath));

if (!temp.file)
{
return false;
}

m_file.write(m_header);
temp.file.write(m_header);

for (const TROPUSRTableHeader& tableHeader : m_tableHeaders)
{
m_file.write(tableHeader);
temp.file.write(tableHeader);
}

for (const auto& entry : m_table4)
{
m_file.write(entry);
temp.file.write(entry);
}

for (const auto& entry : m_table6)
{
m_file.write(entry);
temp.file.write(entry);
}

m_file.release();
return true;
return temp.commit();
}

bool TROPUSRLoader::Generate(const std::string& filepath, const std::string& configpath)
Expand Down

0 comments on commit 0885f1e

Please sign in to comment.