mirror of
https://github.com/thejerf/baijiSteamVR.git
synced 2026-10-18 18:02:27 +02:00
Replaces the hard-coded OpenXR menu long-press shutdown with a proper rebindable hotkey (HK_ANDROID_RETURN_TO_MAIN_MENU, HKGP_ANDROID group), defaulting to a 3-second hold of the left controller's Menu button. The hold threshold lives in HotkeyDispatcher to keep the input side authoritative. The Android settings UI now hides hotkey groups and individual controls that have no dispatcher wiring, so users can't bind actions that would silently no-op at runtime. Adds a Control.getName() JNI getter for identifying functional controls by their untranslated C++ name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
59 lines
1.8 KiB
C++
59 lines
1.8 KiB
C++
// Copyright 2022 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "jni/Input/Control.h"
|
|
|
|
#include <string>
|
|
|
|
#include <jni.h>
|
|
|
|
#include "Common/MsgHandler.h"
|
|
#include "InputCommon/ControlReference/ControlReference.h"
|
|
#include "InputCommon/ControllerEmu/Control/Control.h"
|
|
#include "jni/AndroidCommon/AndroidCommon.h"
|
|
#include "jni/AndroidCommon/IDCache.h"
|
|
#include "jni/Input/ControlReference.h"
|
|
|
|
static ControllerEmu::Control* GetPointer(JNIEnv* env, jobject obj)
|
|
{
|
|
return reinterpret_cast<ControllerEmu::Control*>(
|
|
env->GetLongField(obj, IDCache::GetControlPointer()));
|
|
}
|
|
|
|
jobject ControlToJava(JNIEnv* env, ControllerEmu::Control* control)
|
|
{
|
|
if (!control)
|
|
return nullptr;
|
|
|
|
return env->NewObject(IDCache::GetControlClass(), IDCache::GetControlConstructor(),
|
|
reinterpret_cast<jlong>(control));
|
|
}
|
|
|
|
extern "C" {
|
|
|
|
JNIEXPORT jstring JNICALL
|
|
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_Control_getName(JNIEnv* env,
|
|
jobject obj)
|
|
{
|
|
return ToJString(env, GetPointer(env, obj)->ui_name);
|
|
}
|
|
|
|
JNIEXPORT jstring JNICALL
|
|
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_Control_getUiName(JNIEnv* env,
|
|
jobject obj)
|
|
{
|
|
ControllerEmu::Control* control = GetPointer(env, obj);
|
|
std::string ui_name = control->ui_name;
|
|
if (control->translate == ControllerEmu::Translatability::Translate)
|
|
ui_name = Common::GetStringT(ui_name.c_str());
|
|
return ToJString(env, ui_name);
|
|
}
|
|
|
|
JNIEXPORT jobject JNICALL
|
|
Java_org_dolphinemu_dolphinemu_features_input_model_controlleremu_Control_getControlReference(
|
|
JNIEnv* env, jobject obj)
|
|
{
|
|
return ControlReferenceToJava(env, GetPointer(env, obj)->control_ref.get());
|
|
}
|
|
}
|