diff --git a/OptiScaler/Util.cpp b/OptiScaler/Util.cpp index 4df963da..1e68b2f1 100644 --- a/OptiScaler/Util.cpp +++ b/OptiScaler/Util.cpp @@ -562,7 +562,30 @@ std::optional Util::FindFilePath(const std::filesystem::p // Move up two more levels from 'parent' to reach UE project root but one level for KCD2 std::filesystem::path gameRoot; if (cnt < 2) - gameRoot = parent.parent_path().parent_path(); + { + do + { + // Check one below Win64, old UE games have binaries here + gameRoot = parent.parent_path(); + + if (std::filesystem::exists(gameRoot / "Binaries") && + std::filesystem::is_directory(gameRoot / "Binaries")) + { + gameRoot = gameRoot.parent_path(); + break; + } + + // Check two below Win64, newer UE games have binaries here + gameRoot = gameRoot.parent_path(); + + if (std::filesystem::exists(gameRoot / "Binaries") && + std::filesystem::is_directory(gameRoot / "Binaries")) + { + gameRoot = gameRoot.parent_path(); + break; + } + } while (false); + } else gameRoot = parent.parent_path();