1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +01:00

TRP Loader and undo few cellGame changes

This commit is contained in:
Alexandro Sánchez Bach 2014-02-15 01:06:12 +01:00
parent f2a3db0bd8
commit deaedcb6fa
6 changed files with 103 additions and 3 deletions

View File

@ -0,0 +1 @@
User

View File

@ -123,7 +123,7 @@ int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_t<CellGameConten
type = CELL_GAME_GAMETYPE_DISC;
attributes = 0;
size->hddFreeSizeKB = 40000000; //40 GB, TODO: Use the free space of the computer's HDD where RPCS3 is being run.
size->sizeKB = 0;
size->sizeKB = CELL_GAME_SIZEKB_NOTCALC;
size->sysSizeKB = 0;
Memory.WriteString(dirName.GetAddr(), dir);
@ -150,8 +150,6 @@ int cellGameContentPermit(mem_list_ptr_t<u8> contentInfoPath, mem_list_ptr_t<u8
if (!contentInfoPath.IsGood() || !usrdirPath.IsGood())
return CELL_GAME_ERROR_PARAM;
Memory.WriteString(contentInfoPath.GetAddr(), "/dev_bdvd/PS3_GAME");
Memory.WriteString(usrdirPath.GetAddr(), "/dev_bdvd/PS3_GAME/USRDIR");
return CELL_OK;
}

57
rpcs3/Loader/TRP.cpp Normal file
View File

@ -0,0 +1,57 @@
#include "stdafx.h"
#include "TRP.h"
TRPLoader::TRPLoader(vfsStream& f) : trp_f(f)
{
}
bool TRPLoader::Install(std::string dest, bool show)
{
if(!trp_f.IsOpened()) return false;
if(!LoadHeader(show)) return false;
for (const TRPEntry& entry : m_entries)
{
char* buffer = new char [entry.size];
vfsFile file(dest+entry.name, vfsWrite);
trp_f.Seek(entry.offset);
trp_f.Read(buffer, entry.size);
file.Write(buffer, entry.size);
file.Close();
delete[] buffer;
}
return true;
}
bool TRPLoader::Close()
{
return trp_f.Close();
}
bool TRPLoader::LoadHeader(bool show)
{
trp_f.Seek(0);
if (trp_f.Read(&m_header, sizeof(TRPHeader)) != sizeof(TRPHeader))
return false;
if (!m_header.CheckMagic())
return false;
if (show)
ConLog.Write("TRP version: %x", m_header.trp_version);
m_entries.clear();
m_entries.resize(m_header.trp_files_count);
for(u32 i=0; i<m_header.trp_files_count; i++)
{
if (trp_f.Read(&m_entries[i], sizeof(TRPEntry)) != sizeof(TRPEntry))
return false;
if (show)
ConLog.Write("TRP entry #%d: %s", wxString(m_entries[i].name).wx_str());
}
return true;
}

40
rpcs3/Loader/TRP.h Normal file
View File

@ -0,0 +1,40 @@
#pragma once
#include "Loader.h"
struct TRPHeader
{
u32 trp_magic;
u32 trp_version;
u64 trp_file_size;
u32 trp_files_count;
u32 trp_element_size;
u32 trp_unknown;
unsigned char sha1[20];
unsigned char padding[16];
bool CheckMagic() const {
return trp_magic == 0xDCA23D00;
}
};
struct TRPEntry
{
char name[20];
u64 offset;
u64 size;
u32 unknown;
char padding[12];
};
class TRPLoader
{
vfsStream& trp_f;
TRPHeader m_header;
std::vector<TRPEntry> m_entries;
public:
TRPLoader(vfsStream& f);
virtual bool Install(std::string dest, bool show = false);
virtual bool LoadHeader(bool show = false);
virtual bool Close();
};

View File

@ -316,6 +316,7 @@
<ClCompile Include="Loader\Loader.cpp" />
<ClCompile Include="Loader\PSF.cpp" />
<ClCompile Include="Loader\SELF.cpp" />
<ClCompile Include="Loader\TRP.cpp" />
<ClCompile Include="rpcs3.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>

View File

@ -391,6 +391,9 @@
<ClCompile Include="Emu\Event.cpp">
<Filter>Emu\SysCalls</Filter>
</ClCompile>
<ClCompile Include="Loader\TRP.cpp">
<Filter>Loader</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="rpcs3.rc" />