summaryrefslogtreecommitdiffstats
path: root/src/common/android/android_common.cpp
diff options
context:
space:
mode:
authort895 <clombardo169@gmail.com>2024-02-05 12:07:29 +0100
committert895 <clombardo169@gmail.com>2024-02-08 19:45:26 +0100
commite7c4c8b993ce27a50b7a56f90247056048d20f7d (patch)
treeb87c275f4ea92092f7c8b6cdcb0f50d32819490f /src/common/android/android_common.cpp
parentMerge pull request #12892 from liamwhite/serialization-stuff (diff)
downloadyuzu-e7c4c8b993ce27a50b7a56f90247056048d20f7d.tar
yuzu-e7c4c8b993ce27a50b7a56f90247056048d20f7d.tar.gz
yuzu-e7c4c8b993ce27a50b7a56f90247056048d20f7d.tar.bz2
yuzu-e7c4c8b993ce27a50b7a56f90247056048d20f7d.tar.lz
yuzu-e7c4c8b993ce27a50b7a56f90247056048d20f7d.tar.xz
yuzu-e7c4c8b993ce27a50b7a56f90247056048d20f7d.tar.zst
yuzu-e7c4c8b993ce27a50b7a56f90247056048d20f7d.zip
Diffstat (limited to '')
-rw-r--r--src/common/android/android_common.cpp (renamed from src/android/app/src/main/jni/android_common/android_common.cpp)23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/android/app/src/main/jni/android_common/android_common.cpp b/src/common/android/android_common.cpp
index 7018a52af..e79005658 100644
--- a/src/android/app/src/main/jni/android_common/android_common.cpp
+++ b/src/common/android/android_common.cpp
@@ -1,15 +1,17 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "jni/android_common/android_common.h"
+#include "android_common.h"
#include <string>
#include <string_view>
#include <jni.h>
+#include "common/android/id_cache.h"
#include "common/string_util.h"
-#include "jni/id_cache.h"
+
+namespace Common::Android {
std::string GetJString(JNIEnv* env, jstring jstr) {
if (!jstr) {
@@ -18,7 +20,8 @@ std::string GetJString(JNIEnv* env, jstring jstr) {
const jchar* jchars = env->GetStringChars(jstr, nullptr);
const jsize length = env->GetStringLength(jstr);
- const std::u16string_view string_view(reinterpret_cast<const char16_t*>(jchars), length);
+ const std::u16string_view string_view(reinterpret_cast<const char16_t*>(jchars),
+ static_cast<u32>(length));
const std::string converted_string = Common::UTF16ToUTF8(string_view);
env->ReleaseStringChars(jstr, jchars);
@@ -36,25 +39,27 @@ jstring ToJString(JNIEnv* env, std::u16string_view str) {
}
double GetJDouble(JNIEnv* env, jobject jdouble) {
- return env->GetDoubleField(jdouble, IDCache::GetDoubleValueField());
+ return env->GetDoubleField(jdouble, GetDoubleValueField());
}
jobject ToJDouble(JNIEnv* env, double value) {
- return env->NewObject(IDCache::GetDoubleClass(), IDCache::GetDoubleConstructor(), value);
+ return env->NewObject(GetDoubleClass(), GetDoubleConstructor(), value);
}
s32 GetJInteger(JNIEnv* env, jobject jinteger) {
- return env->GetIntField(jinteger, IDCache::GetIntegerValueField());
+ return env->GetIntField(jinteger, GetIntegerValueField());
}
jobject ToJInteger(JNIEnv* env, s32 value) {
- return env->NewObject(IDCache::GetIntegerClass(), IDCache::GetIntegerConstructor(), value);
+ return env->NewObject(GetIntegerClass(), GetIntegerConstructor(), value);
}
bool GetJBoolean(JNIEnv* env, jobject jboolean) {
- return env->GetBooleanField(jboolean, IDCache::GetBooleanValueField());
+ return env->GetBooleanField(jboolean, GetBooleanValueField());
}
jobject ToJBoolean(JNIEnv* env, bool value) {
- return env->NewObject(IDCache::GetBooleanClass(), IDCache::GetBooleanConstructor(), value);
+ return env->NewObject(GetBooleanClass(), GetBooleanConstructor(), value);
}
+
+} // namespace Common::Android