mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-03-04 12:17:16 +00:00
Remove the java-side directory listing filtering, didn't work.
This commit is contained in:
parent
5c1eaf1933
commit
1f108a0e8c
@ -34,7 +34,7 @@ void Android_StorageSetNativeActivity(jobject nativeActivity) {
|
||||
void Android_RegisterStorageCallbacks(JNIEnv * env, jobject obj) {
|
||||
openContentUri = env->GetMethodID(env->GetObjectClass(obj), "openContentUri", "(Ljava/lang/String;Ljava/lang/String;)I");
|
||||
_dbg_assert_(openContentUri);
|
||||
listContentUriDir = env->GetMethodID(env->GetObjectClass(obj), "listContentUriDir", "(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;");
|
||||
listContentUriDir = env->GetMethodID(env->GetObjectClass(obj), "listContentUriDir", "(Ljava/lang/String;)[Ljava/lang/String;");
|
||||
_dbg_assert_(listContentUriDir);
|
||||
contentUriCreateDirectory = env->GetMethodID(env->GetObjectClass(obj), "contentUriCreateDirectory", "(Ljava/lang/String;Ljava/lang/String;)I");
|
||||
_dbg_assert_(contentUriCreateDirectory);
|
||||
@ -233,8 +233,7 @@ std::vector<File::FileInfo> Android_ListContentUri(const std::string &uri, const
|
||||
double start = time_now_d();
|
||||
|
||||
jstring param = env->NewStringUTF(uri.c_str());
|
||||
jstring filter = prefix.empty() ? nullptr : env->NewStringUTF(prefix.c_str());
|
||||
jobject retval = env->CallObjectMethod(g_nativeActivity, listContentUriDir, param, filter);
|
||||
jobject retval = env->CallObjectMethod(g_nativeActivity, listContentUriDir, param);
|
||||
|
||||
jobjectArray fileList = (jobjectArray)retval;
|
||||
std::vector<File::FileInfo> items;
|
||||
@ -251,6 +250,7 @@ std::vector<File::FileInfo> Android_ListContentUri(const std::string &uri, const
|
||||
} else if (ParseFileInfo(line, &info)) {
|
||||
// We can just reconstruct the URI.
|
||||
info.fullName = Path(uri) / info.name;
|
||||
INFO_LOG(Log::FileSystem, "%s", info.name.c_str());
|
||||
items.push_back(info);
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ static uint64_t FiletimeToStatTime(FILETIME ft) {
|
||||
|
||||
bool GetFileInfo(const Path &path, FileInfo * fileInfo) {
|
||||
if (LOG_IO) {
|
||||
INFO_LOG(Log::System, "GetFileInfo %s", path.c_str());
|
||||
INFO_LOG(Log::System, "GetFileInfo %s", path.ToVisualString().c_str());
|
||||
}
|
||||
if (SIMULATE_SLOW_IO) {
|
||||
sleep_ms(300, "slow-io-sim");
|
||||
@ -178,12 +178,14 @@ std::vector<File::FileInfo> ApplyFilter(std::vector<File::FileInfo> files, const
|
||||
}
|
||||
|
||||
auto pred = [&](const File::FileInfo &info) {
|
||||
// WARNING: Keep in mind that if we return true here, the files is REMOVED from the list.
|
||||
// It's not retain_if.
|
||||
if (!startsWith(info.name, prefix)) {
|
||||
return true;
|
||||
}
|
||||
if (info.isDirectory || !extensionFilter)
|
||||
return false;
|
||||
std::string ext = info.fullName.GetFileExtension();
|
||||
if (!startsWith(info.name, prefix)) {
|
||||
return false;
|
||||
}
|
||||
return filters.find(ext) == filters.end();
|
||||
};
|
||||
files.erase(std::remove_if(files.begin(), files.end(), pred), files.end());
|
||||
@ -192,7 +194,7 @@ std::vector<File::FileInfo> ApplyFilter(std::vector<File::FileInfo> files, const
|
||||
|
||||
bool GetFilesInDir(const Path &directory, std::vector<FileInfo> *files, const char *filter, int flags, std::string_view prefix) {
|
||||
if (LOG_IO) {
|
||||
INFO_LOG(Log::System, "GetFilesInDir %s (ext %s, prefix %.*s)", directory.c_str(), filter, (int)prefix.size(), prefix.data());
|
||||
INFO_LOG(Log::System, "GetFilesInDir '%s' (ext %s, prefix %.*s)", directory.ToVisualString().c_str(), filter, (int)prefix.size(), prefix.data());
|
||||
}
|
||||
if (SIMULATE_SLOW_IO) {
|
||||
sleep_ms(300, "slow-io-sim");
|
||||
@ -202,8 +204,10 @@ bool GetFilesInDir(const Path &directory, std::vector<FileInfo> *files, const ch
|
||||
bool exists = false;
|
||||
// TODO: Move prefix filtering over to the Java side for more speed.
|
||||
std::vector<File::FileInfo> fileList = Android_ListContentUri(directory.ToString(), std::string(prefix), &exists);
|
||||
*files = ApplyFilter(fileList, filter, "");
|
||||
int beforeFilter = (int)fileList.size();
|
||||
*files = ApplyFilter(fileList, filter, prefix);
|
||||
std::sort(files->begin(), files->end());
|
||||
DEBUG_LOG(Log::System, "GetFilesInDir: Found %d entries (%d before filter)", (int)files->size(), beforeFilter);
|
||||
return exists;
|
||||
}
|
||||
|
||||
@ -276,12 +280,9 @@ bool GetFilesInDir(const Path &directory, std::vector<FileInfo> *files, const ch
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
if (SIMULATE_SLOW_IO) {
|
||||
INFO_LOG(Log::System, "GetFilesInDir item %s", virtualName.c_str());
|
||||
sleep_ms(50, "slow-io-sim");
|
||||
if (LOG_IO) {
|
||||
// INFO_LOG(Log::System, "GetFilesInDir item %s", virtualName.c_str());
|
||||
}
|
||||
*/
|
||||
|
||||
FileInfo info;
|
||||
info.name = virtualName;
|
||||
|
@ -420,7 +420,7 @@ bool ExistsInDir(const Path &path, const std::string &filename) {
|
||||
|
||||
bool Exists(const Path &path) {
|
||||
if (LOG_IO) {
|
||||
INFO_LOG(Log::System, "Exists %s", path.c_str());
|
||||
INFO_LOG(Log::System, "Exists %s", path.ToVisualString().c_str());
|
||||
}
|
||||
if (SIMULATE_SLOW_IO) {
|
||||
sleep_ms(200, "slow-io-sim");
|
||||
@ -631,7 +631,7 @@ bool CreateDir(const Path &path) {
|
||||
// Creates the full path of fullPath returns true on success
|
||||
bool CreateFullPath(const Path &path) {
|
||||
if (File::Exists(path)) {
|
||||
DEBUG_LOG(Log::Common, "CreateFullPath: path exists %s", path.c_str());
|
||||
DEBUG_LOG(Log::Common, "CreateFullPath: path exists %s", path.ToVisualString().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -640,7 +640,7 @@ bool CreateFullPath(const Path &path) {
|
||||
case PathType::CONTENT_URI:
|
||||
break; // OK
|
||||
default:
|
||||
ERROR_LOG(Log::Common, "CreateFullPath(%s): Not yet supported", path.c_str());
|
||||
ERROR_LOG(Log::Common, "CreateFullPath(%s): Not yet supported", path.ToVisualString().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3103,7 +3103,7 @@ void TextureCacheCommon::DrawImGuiDebug(uint64_t &selectedTextureId) const {
|
||||
int w = dimWidth(dim);
|
||||
int h = dimHeight(dim);
|
||||
ImGui::Image(texId, ImVec2(w, h));
|
||||
ImGui::Text("%08x: %dx%d, %d mips, %s", selectedTextureId & 0xFFFFFFFF, w, h, entry->maxLevel + 1, GeTextureFormatToString((GETextureFormat)entry->format));
|
||||
ImGui::Text("%08x: %dx%d, %d mips, %s", (uint32_t)(selectedTextureId & 0xFFFFFFFF), w, h, entry->maxLevel + 1, GeTextureFormatToString((GETextureFormat)entry->format));
|
||||
ImGui::Text("Stride: %d", entry->bufw);
|
||||
ImGui::Text("Status: %08x", entry->status); // TODO: Show the flags
|
||||
ImGui::Text("Hash: %08x", entry->fullhash);
|
||||
|
@ -251,7 +251,7 @@ public class PpssppActivity extends NativeActivity {
|
||||
// * https://stackoverflow.com/q
|
||||
// uestions/42186820/documentfile-is-very-slow
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public String[] listContentUriDir(String uriString, String prefix) {
|
||||
public String[] listContentUriDir(String uriString) {
|
||||
Cursor c = null;
|
||||
try {
|
||||
Uri uri = Uri.parse(uriString);
|
||||
@ -262,13 +262,7 @@ public class PpssppActivity extends NativeActivity {
|
||||
|
||||
String selection = null;
|
||||
String[] selectionArgs = null;
|
||||
if (prefix != null) {
|
||||
selection = MediaStore.Files.FileColumns.DISPLAY_NAME + " LIKE ?";
|
||||
// Prefix followed by wildcard
|
||||
selectionArgs = new String[]{ prefix + "%" };
|
||||
}
|
||||
|
||||
c = resolver.query(childrenUri, columns, selection, selectionArgs, null);
|
||||
c = resolver.query(childrenUri, columns, null, null, null);
|
||||
if (c == null) {
|
||||
return new String[]{ "X" };
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user