diff --git a/UnleashedRecomp/kernel/io/file_system.cpp b/UnleashedRecomp/kernel/io/file_system.cpp index c8fe2074..415ae4df 100644 --- a/UnleashedRecomp/kernel/io/file_system.cpp +++ b/UnleashedRecomp/kernel/io/file_system.cpp @@ -327,11 +327,23 @@ uint32_t XWriteFile(FileHandle* hFile, const void* lpBuffer, uint32_t nNumberOfB return TRUE; } +static void fixSlashes(char *path) +{ + while (*path != 0) + { + if (*path == '\\') + { + *path = '/'; + } + + path++; + } +} + const char* FileSystem::TransformPath(const char* path) { thread_local char builtPath[2048]{}; const char* relativePath = strstr(path, ":\\"); - if (relativePath != nullptr) { // rooted folder, handle direction @@ -343,12 +355,19 @@ const char* FileSystem::TransformPath(const char* path) strncpy(builtPath, newRoot.data(), newRoot.size()); builtPath[newRoot.size()] = '\\'; strcpy(builtPath + newRoot.size() + 1, relativePath + 2); - - return builtPath; + } + else + { + strncpy(builtPath, relativePath + 2, sizeof(builtPath)); } } + else + { + strncpy(builtPath, path, sizeof(builtPath)); + } - return relativePath != nullptr ? relativePath + 2 : path; + fixSlashes(builtPath); + return builtPath; } SWA_API const char* XExpandFilePathA(const char* path) diff --git a/UnleashedRecomp/kernel/xam.cpp b/UnleashedRecomp/kernel/xam.cpp index 50f664bc..23b53e50 100644 --- a/UnleashedRecomp/kernel/xam.cpp +++ b/UnleashedRecomp/kernel/xam.cpp @@ -313,7 +313,7 @@ SWA_API uint32_t XamContentCreateEx(uint32_t dwUserIndex, const char* szRootName } else if (pContentData->dwContentType == XCONTENTTYPE_DLC) { - root = ".\\dlc"; + root = "./dlc"; } else { diff --git a/UnleashedRecomp/main.cpp b/UnleashedRecomp/main.cpp index 43b994a7..214b1c64 100644 --- a/UnleashedRecomp/main.cpp +++ b/UnleashedRecomp/main.cpp @@ -50,8 +50,8 @@ void KiSystemStartup() { const auto gameContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Game"); const auto updateContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Update"); - XamRegisterContent(gameContent, std::filesystem::exists(".\\game") ? ".\\game" : "."); - XamRegisterContent(updateContent, ".\\update"); + XamRegisterContent(gameContent, std::filesystem::exists("./game") ? "./game" : "."); + XamRegisterContent(updateContent, "./update"); const auto savePath = GetSavePath(); const auto saveName = "SYS-DATA"; @@ -69,27 +69,6 @@ void KiSystemStartup() // OS mounts game data to D: XamContentCreateEx(0, "D", &gameContent, OPEN_EXISTING, nullptr, nullptr, 0, 0, nullptr); - //WIN32_FIND_DATAA fdata; - //const auto findHandle = FindFirstFileA(".\\dlc\\*.*", &fdata); - //if (findHandle != INVALID_HANDLE_VALUE) - //{ - // char strBuf[256]; - // do - // { - // if (strcmp(fdata.cFileName, ".") == 0 || strcmp(fdata.cFileName, "..") == 0) - // { - // continue; - // } - - // if (fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - // { - // snprintf(strBuf, sizeof(strBuf), ".\\dlc\\%s", fdata.cFileName); - // XamRegisterContent(XamMakeContent(XCONTENTTYPE_DLC, fdata.cFileName), strBuf); - // } - // } while (FindNextFileA(findHandle, &fdata)); - // FindClose(findHandle); - //} - XAudioInitializeSystem(); } diff --git a/UnleashedRecomp/os/linux/logger_linux.cpp b/UnleashedRecomp/os/linux/logger_linux.cpp index 7b11de95..910307ba 100644 --- a/UnleashedRecomp/os/linux/logger_linux.cpp +++ b/UnleashedRecomp/os/linux/logger_linux.cpp @@ -2,10 +2,16 @@ void os::logger::detail::Init() { - assert(false && "Unimplemented."); } void os::logger::detail::Log(const std::string_view str, detail::ELogType type, const char* func) { - assert(false && "Unimplemented."); + if (func) + { + fmt::println("[{}] {}", func, str); + } + else + { + fmt::println("{}", str); + } }