diff --git a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp index 17887272d6..f65a751ff4 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSaveData.cpp @@ -129,7 +129,7 @@ __noinline s32 savedata_op( for (const auto entry : vfsDir(base_dir)) { - if (!(entry->flags & DirEntry_TypeDir)) + if (entry->flags & DirEntry_TypeFile) { continue; } diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp index 20367f4c82..45bfed97a2 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp @@ -100,8 +100,8 @@ int npDrmIsAvailable(u32 k_licensee_addr, vm::ptr drm_path) } } - sceNp.Warning("npDrmIsAvailable: Found DRM license file at %s", drm_path.get_ptr()); - sceNp.Warning("npDrmIsAvailable: Using k_licensee 0x%s", k_licensee_str.c_str()); + sceNp.Warning("npDrmIsAvailable(): Found DRM license file at %s", drm_path.get_ptr()); + sceNp.Warning("npDrmIsAvailable(): Using k_licensee 0x%s", k_licensee_str.c_str()); // Set the necessary file paths. std::string drm_file_name = fmt::AfterLast(drm_path.get_ptr(), '/'); @@ -116,21 +116,20 @@ int npDrmIsAvailable(u32 k_licensee_addr, vm::ptr drm_path) std::string rap_path("/dev_hdd0/home/" + pf_str + "/exdata/"); // Search dev_usb000 for a compatible RAP file. - vfsDir raps_dir(rap_path); - if (!raps_dir.IsOpened()) - sceNp.Warning("npDrmIsAvailable: Can't find RAP file for DRM!"); - else + for (const auto entry : vfsDir(rap_path)) { - for (const DirEntryInfo *entry : raps_dir) + if (entry->name.find(titleID) != std::string::npos) { - if (entry->name.find(titleID) != std::string::npos) - { - rap_path += entry->name; - break; - } + rap_path += entry->name; + break; } } + if (rap_path.back() == '/') + { + sceNp.Warning("npDrmIsAvailable(): Can't find RAP file for '%s' (titleID='%s')", drm_path.get_ptr(), titleID); + } + // Decrypt this EDAT using the supplied k_licensee and matching RAP file. std::string enc_drm_path_local, dec_drm_path_local, rap_path_local; Emu.GetVFS().GetDevice(enc_drm_path, enc_drm_path_local); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp index 5bc935199b..4c941ebf70 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp @@ -91,24 +91,29 @@ int sceNpTrophyInit(u32 pool_addr, u32 poolSize, u32 containerId, u64 options) return CELL_OK; } -int sceNpTrophyCreateContext(vm::ptr context, vm::ptr commID, vm::ptr commSign, u64 options) +int sceNpTrophyCreateContext(vm::ptr context, vm::ptr commID, vm::ptr commSign, u64 options) { - sceNpTrophy.Warning("sceNpTrophyCreateContext(context_addr=0x%x, commID_addr=0x%x, commSign_addr=0x%x, options=0x%llx)", - context.addr(), commID.addr(), commSign.addr(), options); + sceNpTrophy.Warning("sceNpTrophyCreateContext(context=*0x%x, commID=*0x%x, commSign=*0x%x, options=0x%llx)", context, commID, commSign, options); if (!sceNpTrophyInstance.m_bInitialized) + { return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; - if (options & (~(u64)1)) + } + + if (options & ~1) + { return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED; + } // TODO: There are other possible errors // TODO: Is the TROPHY.TRP file necessarily located in this path? - vfsDir dir("/app_home/../TROPDIR/"); - if(!dir.IsOpened()) + if (!Emu.GetVFS().ExistsDir("/app_home/../TROPDIR/")) + { return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST; + } // TODO: Following method will retrieve the TROPHY.TRP of the first folder that contains such file - for(const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read()) + for (const auto entry : vfsDir("/app_home/../TROPDIR/")) { if (entry->flags & DirEntry_TypeDir) { diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index f2527a1d35..4fb909b515 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -106,23 +106,15 @@ void GameViewer::OnColClick(wxListEvent& event) void GameViewer::LoadGames() { - vfsDir dir(m_path); - LOG_NOTICE(HLE, "path: %s", m_path.c_str()); - if(!dir.IsOpened()) return; - m_games.clear(); - for(const DirEntryInfo* info : dir) + for (const auto info : vfsDir(m_path)) { if(info->flags & DirEntry_TypeDir) { m_games.push_back(info->name); } } - dir.Close(); - - //ConLog.Write("path: %s", m_path.wx_str()); - //ConLog.Write("folders count: %d", m_games.GetCount()); } void GameViewer::LoadPSF() diff --git a/rpcs3/Gui/LLEModulesManager.cpp b/rpcs3/Gui/LLEModulesManager.cpp index 5505e3877e..dbf274098d 100644 --- a/rpcs3/Gui/LLEModulesManager.cpp +++ b/rpcs3/Gui/LLEModulesManager.cpp @@ -44,10 +44,9 @@ void LLEModulesManagerFrame::Refresh() Emu.GetVFS().Init(path); - vfsDir dir(path); - loader::handlers::elf64 sprx_loader; - for (const auto info : dir) + + for (const auto info : vfsDir(path)) { if (info->flags & DirEntry_TypeFile) { diff --git a/rpcs3/Loader/ELF64.cpp b/rpcs3/Loader/ELF64.cpp index 30fbd4d5ba..cd2e8a2fc2 100644 --- a/rpcs3/Loader/ELF64.cpp +++ b/rpcs3/Loader/ELF64.cpp @@ -327,6 +327,11 @@ namespace loader for (const auto module : lle_dir) { + if (module->flags & DirEntry_TypeDir) + { + continue; + } + elf64 sprx_handler; vfsFile fsprx(lle_dir.GetPath() + "/" + module->name);