mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
(Android) Add in code to set refresh rate to that of the device's
refresh rate in case display screen has a refresh rate lower than 60Hz - ie. 58.2Hz/59.0Hz - is ifdeffed specifically for PHOENIX_LEGACY - new Phoenix frontend needs to do pass the refresh rate of the screen determined in the Java frontend to the native activity - see phoenix-legacy code
This commit is contained in:
parent
3e9bedd4c7
commit
2b34d21967
@ -37,6 +37,7 @@ struct droid
|
||||
int32_t last_orient;
|
||||
unsigned reinit_video;
|
||||
unsigned activity_paused;
|
||||
float disp_refresh_rate;
|
||||
};
|
||||
|
||||
extern struct droid g_android;
|
||||
|
@ -26,6 +26,10 @@
|
||||
#include "../../../performance.h"
|
||||
#include "../../../driver.h"
|
||||
|
||||
#ifdef PHOENIX_LEGACY
|
||||
#include "../../../config.def.h"
|
||||
#endif
|
||||
|
||||
void free_saved_state(struct android_app* android_app)
|
||||
{
|
||||
pthread_mutex_lock(&android_app->mutex);
|
||||
@ -334,12 +338,21 @@ static void* android_app_entry(void* param)
|
||||
// Get arguments */
|
||||
android_get_char_argv(rom_path, sizeof(rom_path), "ROM");
|
||||
android_get_char_argv(libretro_path, sizeof(libretro_path), "LIBRETRO");
|
||||
#ifdef PHOENIX_LEGACY
|
||||
char refreshrate_char[128];
|
||||
float refreshrate;
|
||||
|
||||
android_get_char_argv(refreshrate_char,sizeof(refreshrate_char), "REFRESHRATE");
|
||||
|
||||
refreshrate = (float)strtod(refreshrate_char, NULL);
|
||||
#endif
|
||||
|
||||
RARCH_LOG("Checking arguments passed...\n");
|
||||
RARCH_LOG("ROM Filename: [%s].\n", rom_path);
|
||||
RARCH_LOG("Libretro path: [%s].\n", libretro_path);
|
||||
|
||||
#ifdef PHOENIX_LEGACY
|
||||
RARCH_LOG("Display Refresh rate: %.2fHz.\n", refreshrate);
|
||||
|
||||
/* ugly hack for now - hardcode libretro path to 'allowed' dir */
|
||||
snprintf(libretro_path, sizeof(libretro_path), "/data/data/com.retroarch/lib/libretro.so");
|
||||
#endif
|
||||
@ -377,6 +390,23 @@ static void* android_app_entry(void* param)
|
||||
|
||||
g_extern.verbose = true;
|
||||
|
||||
#ifdef PHOENIX_LEGACY
|
||||
bool disp_refresh_read = refreshrate > 0.0f;
|
||||
|
||||
g_android.disp_refresh_rate = refresh_rate;
|
||||
|
||||
if(disp_refresh_read)
|
||||
{
|
||||
if(refreshrate < refresh_rate)
|
||||
{
|
||||
RARCH_WARN("Display refresh rate of your device is likely lower than 60Hz.\n");
|
||||
g_android.disp_refresh_rate = refreshrate;
|
||||
}
|
||||
}
|
||||
|
||||
RARCH_LOG("Setting RetroArch video refresh rate to: %.2fHz.\n", g_android.disp_refresh_rate);
|
||||
#endif
|
||||
|
||||
while(!(g_android.input_state & (1ULL << RARCH_WINDOW_READY)))
|
||||
{
|
||||
if(!android_run_events(android_app))
|
||||
|
@ -21,10 +21,13 @@ import com.retroarch.fileio.FileChooser;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.Display;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
import android.os.Bundle;
|
||||
|
||||
@ -50,6 +53,14 @@ public class phoenix extends Activity
|
||||
return true;
|
||||
}
|
||||
|
||||
public float getRefreshRate()
|
||||
{
|
||||
final WindowManager wm = (WindowManager)getSystemService(Context.WINDOW_SERVICE);
|
||||
final Display display = wm.getDefaultDisplay();
|
||||
float rate = display.getRefreshRate();
|
||||
return rate;
|
||||
}
|
||||
|
||||
public boolean onOptionsItemSelected(MenuItem item)
|
||||
{
|
||||
Intent myIntent;
|
||||
@ -91,6 +102,7 @@ public class phoenix extends Activity
|
||||
myIntent = new Intent(this, NativeActivity.class);
|
||||
myIntent.putExtra("ROM", data.getStringExtra("PATH"));
|
||||
myIntent.putExtra("LIBRETRO", libretro_path);
|
||||
myIntent.putExtra("REFRESHRATE", Float.toString(getRefreshRate()));
|
||||
startActivity(myIntent);
|
||||
}
|
||||
else
|
||||
|
@ -189,7 +189,13 @@ void config_set_defaults(void)
|
||||
g_settings.video.second_pass_smooth = second_pass_smooth;
|
||||
#endif
|
||||
|
||||
// Android screens can have variable refresh rates - don't set a
|
||||
// hardcoded value for Android devices
|
||||
#if defined(ANDROID) && defined(PHOENIX_LEGACY)
|
||||
g_settings.video.refresh_rate = g_android.disp_refresh_rate;
|
||||
#else
|
||||
g_settings.video.refresh_rate = refresh_rate;
|
||||
#endif
|
||||
g_settings.video.post_filter_record = post_filter_record;
|
||||
g_settings.video.gpu_record = gpu_record;
|
||||
g_settings.video.gpu_screenshot = gpu_screenshot;
|
||||
|
Loading…
x
Reference in New Issue
Block a user