mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-16 22:25:47 -04:00
Android: Add 'Sync To Host Refresh Rate' option
This commit is contained in:
@ -44,6 +44,7 @@ static jmethodID s_EmulationActivity_method_onEmulationStarted;
|
||||
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 jclass s_PatchCode_class;
|
||||
static jmethodID s_PatchCode_constructor;
|
||||
static jclass s_GameListEntry_class;
|
||||
@ -223,6 +224,20 @@ std::unique_ptr<ByteStream> AndroidHostInterface::OpenPackageFile(const char* pa
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool AndroidHostInterface::GetMainDisplayRefreshRate(float* refresh_rate)
|
||||
{
|
||||
if (!m_emulation_activity_object)
|
||||
return false;
|
||||
|
||||
float value = AndroidHelpers::GetJNIEnv()->CallFloatMethod(m_emulation_activity_object,
|
||||
s_EmulationActivity_method_getRefreshRate);
|
||||
if (value <= 0.0f)
|
||||
return false;
|
||||
|
||||
*refresh_rate = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AndroidHostInterface::SetUserDirectory()
|
||||
{
|
||||
// Already set in constructor.
|
||||
@ -881,6 +896,8 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
env->GetMethodID(s_EmulationActivity_class, "onGameTitleChanged", "(Ljava/lang/String;)V")) == nullptr ||
|
||||
(s_EmulationActivity_method_setVibration = env->GetMethodID(emulation_activity_class, "setVibration", "(Z)V")) ==
|
||||
nullptr ||
|
||||
(s_EmulationActivity_method_getRefreshRate =
|
||||
env->GetMethodID(emulation_activity_class, "getRefreshRate", "()F")) == 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>",
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
int GetIntSettingValue(const char* section, const char* key, int default_value = 0) override;
|
||||
float GetFloatSettingValue(const char* section, const char* key, float default_value = 0.0f) override;
|
||||
std::unique_ptr<ByteStream> OpenPackageFile(const char* path, u32 flags) override;
|
||||
bool GetMainDisplayRefreshRate(float* refresh_rate) override;
|
||||
|
||||
bool IsEmulationThreadRunning() const { return m_emulation_thread_running.load(); }
|
||||
bool IsEmulationThreadPaused() const;
|
||||
|
Reference in New Issue
Block a user