Merge pull request #914 from raven02/patch-1

RSX : Reapply fmt::merge change & VFS change
This commit is contained in:
B1ackDaemon 2014-12-21 11:15:34 +02:00
commit a9647152f7
4 changed files with 15 additions and 21 deletions

View file

@ -137,14 +137,17 @@ std::vector<std::string> fmt::split(const std::string& source, std::initializer_
std::string fmt::merge(std::vector<std::string> source, const std::string& separator) std::string fmt::merge(std::vector<std::string> source, const std::string& separator)
{ {
if (!source.size())
return "";
std::string result; std::string result;
for (auto &s : source) for (int i = 0; i < source.size() - 1; ++i)
{ {
result += s + separator; result += source[i] + separator;
} }
return result; return result + source[source.size() - 1];
} }
std::string fmt::merge(std::initializer_list<std::vector<std::string>> sources, const std::string& separator) std::string fmt::merge(std::initializer_list<std::vector<std::string>> sources, const std::string& separator)

View file

@ -32,21 +32,12 @@ std::string simplify_path(const std::string& path, bool is_dir)
{ {
std::vector<std::string> path_blocks = simplify_path_blocks(path); std::vector<std::string> path_blocks = simplify_path_blocks(path);
std::string result;
if (path_blocks.empty()) if (path_blocks.empty())
return result; return "";
if (is_dir) std::string result = fmt::merge(path_blocks, "/");
{
result = fmt::merge(path_blocks, "/");
}
else
{
result = fmt::merge(std::vector<std::string>(path_blocks.begin(), path_blocks.end() - 1), "/") + path_blocks[path_blocks.size() - 1];
}
return result; return is_dir ? result + "/" : result;
} }
VFS::~VFS() VFS::~VFS()

View file

@ -30,7 +30,7 @@ int cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr<CellGa
size->sysSizeKB = 0; size->sysSizeKB = 0;
} }
vfsFile f("/app_home/../PARAM.SFO"); vfsFile f("/app_home/../../PARAM.SFO");
if (!f.IsOpened()) if (!f.IsOpened())
{ {
cellGame->Error("cellGameBootCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot open PARAM.SFO)"); cellGame->Error("cellGameBootCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot open PARAM.SFO)");
@ -100,7 +100,7 @@ int cellGamePatchCheck(vm::ptr<CellGameContentSize> size, u32 reserved_addr)
size->sysSizeKB = 0; size->sysSizeKB = 0;
} }
vfsFile f("/app_home/../PARAM.SFO"); vfsFile f("/app_home/../../PARAM.SFO");
if (!f.IsOpened()) if (!f.IsOpened())
{ {
cellGame->Error("cellGamePatchCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot open PARAM.SFO)"); cellGame->Error("cellGamePatchCheck(): CELL_GAME_ERROR_ACCESS_ERROR (cannot open PARAM.SFO)");
@ -335,7 +335,7 @@ int cellGameGetParamInt(u32 id, vm::ptr<u32> value)
cellGame->Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.addr()); cellGame->Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.addr());
// TODO: Access through cellGame***Check functions // TODO: Access through cellGame***Check functions
vfsFile f("/app_home/../PARAM.SFO"); vfsFile f("/app_home/../../PARAM.SFO");
PSFLoader psf(f); PSFLoader psf(f);
if(!psf.Load(false)) if(!psf.Load(false))
return CELL_GAME_ERROR_FAILURE; return CELL_GAME_ERROR_FAILURE;
@ -358,7 +358,7 @@ int cellGameGetParamString(u32 id, vm::ptr<char> buf, u32 bufsize)
cellGame->Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.addr(), bufsize); cellGame->Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.addr(), bufsize);
// TODO: Access through cellGame***Check functions // TODO: Access through cellGame***Check functions
vfsFile f("/app_home/../PARAM.SFO"); vfsFile f("/app_home/../../PARAM.SFO");
PSFLoader psf(f); PSFLoader psf(f);
if(!psf.Load(false)) if(!psf.Load(false))
return CELL_GAME_ERROR_FAILURE; return CELL_GAME_ERROR_FAILURE;

View file

@ -96,7 +96,7 @@ int sceNpTrophyCreateContext(vm::ptr<u32> context, vm::ptr<SceNpCommunicationId>
// TODO: There are other possible errors // TODO: There are other possible errors
// TODO: Is the TROPHY.TRP file necessarily located in this path? // TODO: Is the TROPHY.TRP file necessarily located in this path?
vfsDir dir("/app_home/../TROPDIR/"); vfsDir dir("/app_home/../../TROPDIR/");
if(!dir.IsOpened()) if(!dir.IsOpened())
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST; return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
@ -105,7 +105,7 @@ int sceNpTrophyCreateContext(vm::ptr<u32> context, vm::ptr<SceNpCommunicationId>
{ {
if (entry->flags & DirEntry_TypeDir) if (entry->flags & DirEntry_TypeDir)
{ {
vfsStream* stream = Emu.GetVFS().OpenFile("/app_home/../TROPDIR/" + entry->name + "/TROPHY.TRP", vfsRead); vfsStream* stream = Emu.GetVFS().OpenFile("/app_home/../../TROPDIR/" + entry->name + "/TROPHY.TRP", vfsRead);
if (stream && stream->IsOpened()) if (stream && stream->IsOpened())
{ {