Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Added basic file explorer functionality #1894

Open
wants to merge 2 commits into
base: alpha
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions libswirl/android/Android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ static jmethodID VJoyStartEditingMID;
static jmethodID VJoyStopEditingMID;
static jmethodID VJoyResetEditingMID;
static jmethodID MsgboxMID;
static jmethodID showVirtualKeyboardMID;

JNIEXPORT void JNICALL Java_com_reicast_emulator_BaseGLActivity_register(JNIEnv *env, jobject obj, jobject activity)
{
Expand All @@ -661,9 +662,23 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_BaseGLActivity_register(JNIEnv
VJoyStopEditingMID = env->GetMethodID(env->GetObjectClass(activity), "VJoyStopEditing", "(Z)V");
VJoyResetEditingMID = env->GetMethodID(env->GetObjectClass(activity), "VJoyResetEditing", "()V");
MsgboxMID = env->GetMethodID(env->GetObjectClass(activity), "Msgbox", "(Ljava/lang/String;I)I");
showVirtualKeyboardMID = env->GetMethodID(env->GetObjectClass(activity), "showVirtualKeyboard", "(Ljava/lang/String;)Ljava/lang/String;");
}
}

std::string showvirtualKeyboard(const std::string& path) {

JNIEnv* env = jvm_attacher.getEnv();
auto jstr = env->NewStringUTF(path.c_str());
jstring resultJNIStr = (jstring)env->CallObjectMethod(g_activity, showVirtualKeyboardMID, jstr);
const char* resultCStr = env->GetStringUTFChars(resultJNIStr, NULL);
size_t length = (size_t)env->GetStringUTFLength(resultJNIStr);
std::string resultStr(resultCStr, length);
env->ReleaseStringUTFChars(resultJNIStr, resultCStr);
return resultStr;

}

void vjoy_start_editing()
{
jvm_attacher.getEnv()->CallVoidMethod(g_activity, VJoyStartEditingMID);
Expand Down
Loading