cellGame, cellSysutil and TRP installer improved

* TRP Loader and sceNpTrophyRegisterContext improved.
* cellSysutil constants moved to cellSysutil.h
* cellGameBootCheck bug fixed that makes size->hddFreeSizeKB be 0.
* Added system language selector (this is *not* RPCS3's language).
cellSysutilGetSystemParamInt(0x111) will return the selected language.

NOTE: The problems caused by the last commit (pull request #104 merged)
are not yet fixed.
This commit is contained in:
Alexandro Sánchez Bach 2014-03-17 20:34:19 +01:00
parent 9786c036d5
commit cf4501fe41
8 changed files with 270 additions and 162 deletions

View file

@ -5,10 +5,15 @@ TRPLoader::TRPLoader(vfsStream& f) : trp_f(f)
{
}
TRPLoader::~TRPLoader()
{
Close();
}
bool TRPLoader::Install(std::string dest, bool show)
{
if(!trp_f.IsOpened()) return false;
if(!LoadHeader(show)) return false;
if(!trp_f.IsOpened())
return false;
if (!dest.empty() && dest.back() != '/')
dest += '/';
@ -28,13 +33,11 @@ bool TRPLoader::Install(std::string dest, bool show)
return true;
}
bool TRPLoader::Close()
{
return trp_f.Close();
}
bool TRPLoader::LoadHeader(bool show)
{
if(!trp_f.IsOpened())
return false;
trp_f.Seek(0);
if (trp_f.Read(&m_header, sizeof(TRPHeader)) != sizeof(TRPHeader))
return false;
@ -59,3 +62,36 @@ bool TRPLoader::LoadHeader(bool show)
return true;
}
bool TRPLoader::ContainsEntry(char *filename)
{
for (const TRPEntry& entry : m_entries) {
if (!strcmp(entry.name, filename))
return true;
}
return false;
}
void TRPLoader::RemoveEntry(char *filename)
{
std::vector<TRPEntry>::iterator i = m_entries.begin();
while (i != m_entries.end()) {
if (!strcmp(i->name, filename))
i = m_entries.erase(i);
else
i++;
}
}
void TRPLoader::RenameEntry(char *oldname, char *newname)
{
for (const TRPEntry& entry : m_entries) {
if (!strcmp(entry.name, oldname))
memcpy((void*)entry.name, newname, 32);
}
}
bool TRPLoader::Close()
{
return trp_f.Close();
}