diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-02-09 17:49:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-09 17:49:25 +0100 |
commit | 7ec7ff0f303504950e4270e91076a33efd0ceb17 (patch) | |
tree | 1e8346f775550eefd491aa8280412d86000dd637 /src/common/fs/fs_android.h | |
parent | Merge pull request #12927 from german77/cheat-pause (diff) | |
parent | android: Run OnEmulationStarted frontend callback in another thread (diff) | |
download | yuzu-7ec7ff0f303504950e4270e91076a33efd0ceb17.tar yuzu-7ec7ff0f303504950e4270e91076a33efd0ceb17.tar.gz yuzu-7ec7ff0f303504950e4270e91076a33efd0ceb17.tar.bz2 yuzu-7ec7ff0f303504950e4270e91076a33efd0ceb17.tar.lz yuzu-7ec7ff0f303504950e4270e91076a33efd0ceb17.tar.xz yuzu-7ec7ff0f303504950e4270e91076a33efd0ceb17.tar.zst yuzu-7ec7ff0f303504950e4270e91076a33efd0ceb17.zip |
Diffstat (limited to 'src/common/fs/fs_android.h')
-rw-r--r-- | src/common/fs/fs_android.h | 58 |
1 files changed, 12 insertions, 46 deletions
diff --git a/src/common/fs/fs_android.h b/src/common/fs/fs_android.h index 2c9234313..b33f4beb8 100644 --- a/src/common/fs/fs_android.h +++ b/src/common/fs/fs_android.h @@ -7,38 +7,17 @@ #include <vector> #include <jni.h> -#define ANDROID_STORAGE_FUNCTIONS(V) \ - V(OpenContentUri, int, (const std::string& filepath, OpenMode openmode), open_content_uri, \ - "openContentUri", "(Ljava/lang/String;Ljava/lang/String;)I") - -#define ANDROID_SINGLE_PATH_DETERMINE_FUNCTIONS(V) \ - V(GetSize, std::uint64_t, get_size, CallStaticLongMethod, "getSize", "(Ljava/lang/String;)J") \ - V(IsDirectory, bool, is_directory, CallStaticBooleanMethod, "isDirectory", \ - "(Ljava/lang/String;)Z") \ - V(Exists, bool, file_exists, CallStaticBooleanMethod, "exists", "(Ljava/lang/String;)Z") - -#define ANDROID_SINGLE_PATH_HELPER_FUNCTIONS(V) \ - V(GetParentDirectory, get_parent_directory, CallStaticObjectMethod, "getParentDirectory", \ - "(Ljava/lang/String;)Ljava/lang/String;") \ - V(GetFilename, get_filename, CallStaticObjectMethod, "getFilename", \ - "(Ljava/lang/String;)Ljava/lang/String;") - namespace Common::FS::Android { static JavaVM* g_jvm = nullptr; static jclass native_library = nullptr; -#define FH(FunctionName, JMethodID, Caller, JMethodName, Signature) F(JMethodID) -#define FR(FunctionName, ReturnValue, JMethodID, Caller, JMethodName, Signature) F(JMethodID) -#define FS(FunctionName, ReturnValue, Parameters, JMethodID, JMethodName, Signature) F(JMethodID) -#define F(JMethodID) static jmethodID JMethodID = nullptr; -ANDROID_SINGLE_PATH_HELPER_FUNCTIONS(FH) -ANDROID_SINGLE_PATH_DETERMINE_FUNCTIONS(FR) -ANDROID_STORAGE_FUNCTIONS(FS) -#undef F -#undef FS -#undef FR -#undef FH +static jmethodID s_get_parent_directory; +static jmethodID s_get_filename; +static jmethodID s_get_size; +static jmethodID s_is_directory; +static jmethodID s_file_exists; +static jmethodID s_open_content_uri; enum class OpenMode { Read, @@ -57,24 +36,11 @@ void UnRegisterCallbacks(); bool IsContentUri(const std::string& path); -#define FS(FunctionName, ReturnValue, Parameters, JMethodID, JMethodName, Signature) \ - F(FunctionName, Parameters, ReturnValue) -#define F(FunctionName, Parameters, ReturnValue) ReturnValue FunctionName Parameters; -ANDROID_STORAGE_FUNCTIONS(FS) -#undef F -#undef FS - -#define FR(FunctionName, ReturnValue, JMethodID, Caller, JMethodName, Signature) \ - F(FunctionName, ReturnValue) -#define F(FunctionName, ReturnValue) ReturnValue FunctionName(const std::string& filepath); -ANDROID_SINGLE_PATH_DETERMINE_FUNCTIONS(FR) -#undef F -#undef FR - -#define FH(FunctionName, JMethodID, Caller, JMethodName, Signature) F(FunctionName) -#define F(FunctionName) std::string FunctionName(const std::string& filepath); -ANDROID_SINGLE_PATH_HELPER_FUNCTIONS(FH) -#undef F -#undef FH +int OpenContentUri(const std::string& filepath, OpenMode openmode); +std::uint64_t GetSize(const std::string& filepath); +bool IsDirectory(const std::string& filepath); +bool Exists(const std::string& filepath); +std::string GetParentDirectory(const std::string& filepath); +std::string GetFilename(const std::string& filepath); } // namespace Common::FS::Android |