From 15fafe54153e1d9266f04d2d782216beb2a60a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 18 Jul 2021 22:44:54 +0200 Subject: [PATCH] Fix date/time display for savestates --- Common/File/AndroidStorage.cpp | 13 ++++++++++++- Common/File/DirListing.h | 4 ---- android/src/org/ppsspp/ppsspp/PpssppActivity.java | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Common/File/AndroidStorage.cpp b/Common/File/AndroidStorage.cpp index 8321b4c50f..6c4cbbd60d 100644 --- a/Common/File/AndroidStorage.cpp +++ b/Common/File/AndroidStorage.cpp @@ -124,7 +124,18 @@ static bool ParseFileInfo(const std::string &line, File::FileInfo *fileInfo) { sscanf(parts[1].c_str(), "%" PRIu64, &fileInfo->size); fileInfo->fullName = Path(parts[3]); fileInfo->isWritable = true; // TODO: Should be passed as part of the string. - sscanf(parts[4].c_str(), "%" PRIu64, &fileInfo->lastModified); + fileInfo->access = 0777; // TODO: For read-only mappings, reflect that here, similarly as with isWritable. + + uint64_t lastModifiedMs = 0; + sscanf(parts[4].c_str(), "%" PRIu64, &lastModifiedMs); + + // Convert from milliseconds + uint32_t lastModified = lastModifiedMs / 1000; + + // We don't have better information, so let's just spam lastModified into all the date/time fields. + fileInfo->mtime = lastModified; + fileInfo->ctime = lastModified; + fileInfo->atime = lastModified; return true; } diff --git a/Common/File/DirListing.h b/Common/File/DirListing.h index baac6649c3..99c938630e 100644 --- a/Common/File/DirListing.h +++ b/Common/File/DirListing.h @@ -24,10 +24,6 @@ struct FileInfo { uint64_t ctime = 0; uint32_t access = 0; // st_mode & 0x1ff - // Currently only supported for Android storage files. - // Other places use different methods to get this. - uint64_t lastModified = 0; - bool operator <(const FileInfo &other) const; }; diff --git a/android/src/org/ppsspp/ppsspp/PpssppActivity.java b/android/src/org/ppsspp/ppsspp/PpssppActivity.java index c5cc646d53..a35da130e8 100644 --- a/android/src/org/ppsspp/ppsspp/PpssppActivity.java +++ b/android/src/org/ppsspp/ppsspp/PpssppActivity.java @@ -148,6 +148,7 @@ public class PpssppActivity extends NativeActivity { return str; } + // TODO: Maybe add a cheaper version that doesn't extract all the file information? public String[] listContentUriDir(String uriString) { try { Uri uri = Uri.parse(uriString);