diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index 5e157f35b0..3ba4035bb7 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -175,6 +175,14 @@ IFileSystem *MetaFileSystem::GetHandleOwner(u32 handle) const return nullptr; } +std::string MetaFileSystem::GetCurrentDirForThread(int threadID) const { + auto iter = currentDir.find(threadID); + if (iter == currentDir.end()) { + return ""; + } + return iter->second; +} + int MetaFileSystem::MapFilePath(std::string_view _inpath, std::string *outpath, MountPoint **system) { int error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; std::lock_guard guard(lock); @@ -204,7 +212,7 @@ int MetaFileSystem::MapFilePath(std::string_view _inpath, std::string *outpath, // Hm, does this make sense? Doesn't each drive has its own currentDir per thread, or maybe not? int currentThread = __KernelGetCurThread(); - currentDir_t::iterator it = currentDir.find(currentThread); + auto it = currentDir.find(currentThread); if (it == currentDir.end()) { // Attempt to emulate SCE_KERNEL_ERROR_NOCWD / 8002032C: may break things requiring fixes elsewhere if (inpath.find(':') == std::string::npos /* means path is relative */) { diff --git a/Core/FileSystems/MetaFileSystem.h b/Core/FileSystems/MetaFileSystem.h index 9c1fca6fad..dc71263b99 100644 --- a/Core/FileSystems/MetaFileSystem.h +++ b/Core/FileSystems/MetaFileSystem.h @@ -44,8 +44,7 @@ private: // The order of this vector is meaningful - lookups are always a linear search from the start. std::vector fileSystems; - typedef std::map currentDir_t; - currentDir_t currentDir; + std::map currentDir; std::string startingDirectory; mutable std::recursive_mutex lock; // must be recursive. TODO: fix that @@ -88,6 +87,8 @@ public: void ThreadEnded(int threadID); void Shutdown(); + std::string GetCurrentDirForThread(int threadID) const; + u32 GetNewHandle() override { u32 res = current++; if (current < 0) { diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index c9d638eb85..02a01c5cff 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -712,8 +712,7 @@ void ImportFuncSymbol(const FuncSymbolImport &func, bool reimporting, const char if (shouldHLE && GetHLEFunc(func.moduleName, func.nid)) { if (reimporting && Memory::Read_Instruction(func.stubAddr + 4) != GetSyscallOp(func.moduleName, func.nid)) { const char *name = GetHLEFuncName(func.moduleName, func.nid); - char temp[256]; - if (temp) { + if (name) { WARN_LOG(Log::Loader, "Reimporting updated syscall from %s: %s", func.moduleName, name); } else { WARN_LOG(Log::Loader, "Reimporting updated syscall from %s: zz_%08x", func.moduleName, func.nid); diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index 491330d186..cbbe2c16d1 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -419,15 +419,16 @@ void DrawThreadView(ImConfig &cfg, ImControl &control) { } std::vector info = GetThreadsInfo(); - if (ImGui::BeginTable("threads", 8, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) { + if (ImGui::BeginTable("threads", 9, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) { ImGui::TableSetupColumn("Id", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("PC", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("Entry", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("Priority", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("State", ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("Wait Type", ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("Wait ID", ImGuiTableColumnFlags_WidthStretch); + ImGui::TableSetupColumn("Wait Type", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("Wait ID", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("Cur Dir", ImGuiTableColumnFlags_WidthStretch); // .initialStack, .stackSize, etc ImGui::TableHeadersRow(); @@ -459,6 +460,9 @@ void DrawThreadView(ImConfig &cfg, ImControl &control) { char temp[64]; WaitIDToString(thread.waitType, thread.waitID, temp, sizeof(temp)); ImGui::TextUnformatted(temp); + std::string curDir = pspFileSystem.GetCurrentDirForThread(thread.id); + ImGui::TableNextColumn(); + ImGui::TextUnformatted(curDir.empty() ? "N/A" : curDir.c_str()); if (ImGui::BeginPopup("threadPopup")) { DebugThreadInfo &thread = info[i]; ImGui::Text("Thread: %s", thread.name);