diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 80e6570850..5d4d8c1b76 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -46,6 +46,7 @@ #include "Common/Net/HTTPClient.h" #include "Common/Net/Resolve.h" +#include "Common/Net/URL.h" #include "Common/Render/TextureAtlas.h" #include "Common/Render/Text/draw_text.h" #include "Common/GPU/OpenGL/GLFeatures.h" @@ -683,7 +684,14 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch } } if (okToLoad) { - boot_filename = Path(std::string(argv[i])); + std::string str = std::string(argv[i]); + // Handle file:/// URIs, since you get those when creating shortcuts on some Android systems. + if (startsWith(str, "file:///")) { + str = UriDecode(str.substr(7)); + INFO_LOG(IO, "Decoding '%s' to '%s'", argv[i], str.c_str()); + } + + boot_filename = Path(str); skipLogo = true; } if (okToLoad && okToCheck) { diff --git a/android/src/org/ppsspp/ppsspp/ShortcutActivity.java b/android/src/org/ppsspp/ppsspp/ShortcutActivity.java index 7e84cefb26..d21c3bddca 100644 --- a/android/src/org/ppsspp/ppsspp/ShortcutActivity.java +++ b/android/src/org/ppsspp/ppsspp/ShortcutActivity.java @@ -103,6 +103,12 @@ public class ShortcutActivity extends Activity { } catch (Exception e) { Log.i(TAG, "Exception getting name: " + e); } + } else if (path.startsWith("file:///")) { + try { + pathStr = java.net.URLDecoder.decode(path.substring(7), StandardCharsets.UTF_8.name()); + } catch (Exception e) { + Log.i(TAG, "Exception getting name: " + e); + } } else { pathStr = path; } @@ -111,6 +117,8 @@ public class ShortcutActivity extends Activity { name = pathSegments[pathSegments.length - 1]; /* + // No longer working for various reasons. + PpssppActivity.CheckABIAndLoadLibrary(); String name = queryGameName(path); if (name.equals("")) { @@ -119,7 +127,7 @@ public class ShortcutActivity extends Activity { return; }*/ - Log.i(TAG, "Game name: " + name + " : Creating shortcut to " + path); + Log.i(TAG, "Game name: " + name + " : Creating shortcut to " + uri.toString()); // This is Intent that will be returned by this method, as response to // ACTION_CREATE_SHORTCUT. Wrap shortcut intent inside this intent.