mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-14 02:55:46 -04:00
Android: Add 'Open Pause Menu' hotkey
This commit is contained in:
@ -45,6 +45,7 @@ static jmethodID s_EmulationActivity_method_onEmulationStopped;
|
||||
static jmethodID s_EmulationActivity_method_onGameTitleChanged;
|
||||
static jmethodID s_EmulationActivity_method_setVibration;
|
||||
static jmethodID s_EmulationActivity_method_getRefreshRate;
|
||||
static jmethodID s_EmulationActivity_method_openPauseMenu;
|
||||
static jclass s_PatchCode_class;
|
||||
static jmethodID s_PatchCode_constructor;
|
||||
static jclass s_GameListEntry_class;
|
||||
@ -224,6 +225,19 @@ std::unique_ptr<ByteStream> AndroidHostInterface::OpenPackageFile(const char* pa
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AndroidHostInterface::RegisterHotkeys()
|
||||
{
|
||||
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "General")), StaticString("OpenPauseMenu"),
|
||||
StaticString(TRANSLATABLE("Hotkeys", "Open Pause Menu")), [this](bool pressed) {
|
||||
if (pressed) {
|
||||
AndroidHelpers::GetJNIEnv()->CallVoidMethod(m_emulation_activity_object,
|
||||
s_EmulationActivity_method_openPauseMenu);
|
||||
}
|
||||
});
|
||||
|
||||
CommonHostInterface::RegisterHotkeys();
|
||||
}
|
||||
|
||||
bool AndroidHostInterface::GetMainDisplayRefreshRate(float* refresh_rate)
|
||||
{
|
||||
if (!m_emulation_activity_object)
|
||||
@ -898,6 +912,8 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
nullptr ||
|
||||
(s_EmulationActivity_method_getRefreshRate =
|
||||
env->GetMethodID(emulation_activity_class, "getRefreshRate", "()F")) == nullptr ||
|
||||
(s_EmulationActivity_method_openPauseMenu =
|
||||
env->GetMethodID(emulation_activity_class, "openPauseMenu", "()V")) == nullptr ||
|
||||
(s_PatchCode_constructor = env->GetMethodID(s_PatchCode_class, "<init>", "(ILjava/lang/String;Z)V")) == nullptr ||
|
||||
(s_GameListEntry_constructor = env->GetMethodID(
|
||||
s_GameListEntry_class, "<init>",
|
||||
|
@ -72,6 +72,7 @@ protected:
|
||||
void SetUserDirectory() override;
|
||||
void LoadSettings() override;
|
||||
void UpdateInputMap() override;
|
||||
void RegisterHotkeys() override;
|
||||
|
||||
bool AcquireHostDisplay() override;
|
||||
void ReleaseHostDisplay() override;
|
||||
|
@ -154,6 +154,12 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
|
||||
return display.getRefreshRate();
|
||||
}
|
||||
|
||||
public void openPauseMenu() {
|
||||
runOnUiThread(() -> {
|
||||
showMenu();
|
||||
});
|
||||
}
|
||||
|
||||
private void doApplySettings() {
|
||||
AndroidHostInterface.getInstance().applySettings();
|
||||
updateRequestedOrientation();
|
||||
|
Reference in New Issue
Block a user