FileExists() fixed

This commit is contained in:
Nekotekina 2014-07-01 16:21:55 +04:00
parent 017e44cf4d
commit 2d1409c706
4 changed files with 19 additions and 1 deletions

View File

@ -115,3 +115,8 @@ bool vfsLocalFile::IsOpened() const
{
return m_file.IsOpened() && vfsFileBase::IsOpened();
}
bool vfsLocalFile::Exists(const std::string& path)
{
return rFileExists(path);
}

View File

@ -12,6 +12,7 @@ public:
virtual bool Open(const std::string& path, vfsOpenMode mode = vfsRead) override;
virtual bool Create(const std::string& path) override;
virtual bool Close() override;
virtual bool Exists(const std::string& path) override;
virtual u64 GetSize() override;

View File

@ -30,6 +30,12 @@ int sceNpDrmIsAvailable(u32 k_licensee_addr, u32 drm_path_addr)
sceNp->Warning("sceNpDrmIsAvailable(k_licensee_addr=0x%x, drm_path_addr=0x%x)", k_licensee_addr, drm_path_addr);
std::string drm_path = Memory.ReadString(drm_path_addr);
if (!Emu.GetVFS().ExistsFile(drm_path))
{
sceNp->Warning("sceNpDrmIsAvailable(): '%s' not found", drm_path.c_str());
return CELL_ENOENT;
}
std::string k_licensee_str;
u8 k_licensee[0x10];
for(int i = 0; i < 0x10; i++)

View File

@ -116,6 +116,12 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
return CELL_EINVAL;
}
if (!Emu.GetVFS().ExistsFile(ppath))
{
sys_fs->Error("\"%s\" not found! flags: 0x%08x", ppath.c_str(), flags);
return CELL_ENOENT;
}
vfsFileBase* stream = Emu.GetVFS().OpenFile(ppath, o_mode);
if(!stream || !stream->IsOpened())
@ -126,7 +132,7 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
}
fd = sys_fs->GetNewId(stream, IDFlag_File);
LOG_WARNING(HLE, "*** cellFsOpen(path=\"%s\"): fd = %d", path.c_str(), fd.GetValue());
LOG_WARNING(HLE, "\"%s\" opened: fd = %d", path.c_str(), fd.GetValue());
return CELL_OK;
}