diff --git a/rpcsx-os/vfs.cpp b/rpcsx-os/vfs.cpp index c419e6102..c84ac3395 100644 --- a/rpcsx-os/vfs.cpp +++ b/rpcsx-os/vfs.cpp @@ -10,13 +10,23 @@ #include struct DevFs : IoDevice { - std::map> devices; + std::map, std::less<>> devices; orbis::ErrorCode open(orbis::Ref *file, const char *path, std::uint32_t flags, std::uint32_t mode, orbis::Thread *thread) override { - if (auto it = devices.find(path); it != devices.end()) { - return it->second->open(file, path, flags, mode, thread); + std::string_view devPath = path; + if (auto pos = devPath.find('/'); pos != std::string_view::npos) { + auto deviceName = devPath.substr(0, pos); + devPath.remove_prefix(pos + 1); + + if (auto it = devices.find(deviceName); it != devices.end()) { + return it->second->open(file, std::string(devPath).c_str(), flags, mode, thread); + } + } else { + if (auto it = devices.find(devPath); it != devices.end()) { + return it->second->open(file, "", flags, mode, thread); + } } std::fprintf(stderr, "device %s not exists\n", path);