mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
parent
d40aaf0391
commit
489ded43b1
3 changed files with 21 additions and 6 deletions
|
@ -331,7 +331,7 @@ error_code sceNpTrophyRegisterContext(ppu_thread& ppu, u32 context, u32 handle,
|
||||||
|
|
||||||
error_code sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64> reqspace, u64 options)
|
error_code sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64> reqspace, u64 options)
|
||||||
{
|
{
|
||||||
sceNpTrophy.todo("sceNpTrophyGetRequiredDiskSpace(context=0x%x, handle=0x%x, reqspace=*0x%x, options=0x%llx)", context, handle, reqspace, options);
|
sceNpTrophy.warning("sceNpTrophyGetRequiredDiskSpace(context=0x%x, handle=0x%x, reqspace=*0x%x, options=0x%llx)", context, handle, reqspace, options);
|
||||||
|
|
||||||
if (!reqspace)
|
if (!reqspace)
|
||||||
{
|
{
|
||||||
|
@ -352,12 +352,18 @@ error_code sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64>
|
||||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is not accurate. It's just an approximation of the real value
|
if (!fs::is_dir("/dev_hdd0/home/00000001/trophy/" + ctxt->trp_name))
|
||||||
// The real value can be obtained in TRP.cpp:
|
{
|
||||||
// m_headers.trp_file_size - sizeof(m_headers) - (m_headers.trp_files_count * m_headers.trp_element_size);
|
TRPLoader trp(ctxt->trp_stream);
|
||||||
// TODO: eventually this should be set to 0 when trophys are detected as already installed, setting to 0 now causes some games to not call registerContext, which leads to trophys never getting installed
|
|
||||||
*reqspace = ctxt->trp_stream.size();
|
|
||||||
|
|
||||||
|
if (trp.LoadHeader())
|
||||||
|
{
|
||||||
|
*reqspace = trp.GetRequiredSpace();
|
||||||
|
return CELL_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*reqspace = 0;
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,14 @@ bool TRPLoader::LoadHeader(bool show)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u64 TRPLoader::GetRequiredSpace() const
|
||||||
|
{
|
||||||
|
const u64 file_size = m_header.trp_file_size;
|
||||||
|
const u64 file_element_size = u64{1} * m_header.trp_files_count * m_header.trp_element_size;
|
||||||
|
|
||||||
|
return file_size - sizeof(m_header) - file_element_size;
|
||||||
|
}
|
||||||
|
|
||||||
bool TRPLoader::ContainsEntry(const char *filename)
|
bool TRPLoader::ContainsEntry(const char *filename)
|
||||||
{
|
{
|
||||||
for (const TRPEntry& entry : m_entries)
|
for (const TRPEntry& entry : m_entries)
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
|
|
||||||
bool Install(const std::string& dest, bool show = false);
|
bool Install(const std::string& dest, bool show = false);
|
||||||
bool LoadHeader(bool show = false);
|
bool LoadHeader(bool show = false);
|
||||||
|
u64 GetRequiredSpace() const;
|
||||||
|
|
||||||
bool ContainsEntry(const char *filename);
|
bool ContainsEntry(const char *filename);
|
||||||
void RemoveEntry(const char *filename);
|
void RemoveEntry(const char *filename);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue