From 37aa59fb3ce3352eda0045eebd5198d422dd2dc4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 12 May 2013 16:01:38 -0700 Subject: [PATCH] Keep track of disc0:/ vs. disc0: in path parsing. The difference matters and was getting lost. --- Core/FileSystems/MetaFileSystem.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index 4393f406c1..d1cb26a0a8 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -131,6 +131,13 @@ static bool RealPath(const std::string ¤tDirectory, const std::string &inP inAfterColon = inPath.substr(inColon + 1); } + // Special case: "disc0:" is different from "disc0:/", so keep track of the single slash. + if (inAfterColon == "/") + { + outPath = prefix + inAfterColon; + return true; + } + if (! ApplyPathStringToComponentsVector(cmpnts, inAfterColon) ) { WARN_LOG(HLE, "RealPath: inPath is not a valid path: \"%s\"", inPath.c_str()); @@ -170,9 +177,9 @@ bool MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpat // Special handling: host0:command.txt (as seen in Super Monkey Ball Adventures, for example) // appears to mean the current directory on the UMD. Let's just assume the current directory. std::string inpath = _inpath; - if (strncasecmp(inpath.c_str(), "host0:", 5) == 0) { + if (strncasecmp(inpath.c_str(), "host0:", strlen("host0:")) == 0) { INFO_LOG(HLE, "Host0 path detected, stripping: %s", inpath.c_str()); - inpath = inpath.substr(6); + inpath = inpath.substr(strlen("host0:")); } const std::string *currentDirectory = &startingDirectory;