mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 19:35:41 -04:00
Android: Add 'Sync To Host Refresh Rate' option
This commit is contained in:
@ -11,10 +11,12 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Vibrator;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
@ -137,6 +139,21 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
|
||||
});
|
||||
}
|
||||
|
||||
public float getRefreshRate() {
|
||||
WindowManager windowManager = getWindowManager();
|
||||
if (windowManager == null) {
|
||||
windowManager = ((WindowManager) getSystemService(Context.WINDOW_SERVICE));
|
||||
if (windowManager == null)
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
Display display = windowManager.getDefaultDisplay();
|
||||
if (display == null)
|
||||
return -1.0f;
|
||||
|
||||
return display.getRefreshRate();
|
||||
}
|
||||
|
||||
private void doApplySettings() {
|
||||
AndroidHostInterface.getInstance().applySettings();
|
||||
updateRequestedOrientation();
|
||||
|
@ -191,4 +191,6 @@
|
||||
<string name="game_properties_tab_controller_settings">Controller Settings</string>
|
||||
<string name="settings_audio_resampling">Audio Resampling</string>
|
||||
<string name="settings_summary_audio_resampling">When running outside of 100% speed, resamples audio from the target speed instead of dropping frames. Produces much nicer fast forward/slowdown audio at a small cost to performance.</string>
|
||||
<string name="settings_general_sync_to_host_refresh_rate">Sync To Host Refresh Rate</string>
|
||||
<string name="settings_summary_general_sync_to_host_refresh_rate">Adjusts the emulation speed so the console\'s refresh rate matches the host\'s refresh rate, when VSync and Audio Resampling is enabled. This results in the smoothest animations possible, at the cost of potentially increasing the emulation speed by less than 1%.</string>
|
||||
</resources>
|
||||
|
@ -78,6 +78,13 @@
|
||||
app:defaultValue="false"
|
||||
app:summary="@string/settings_summary_video_sync"
|
||||
app:iconSpaceReserved="false" />
|
||||
<SwitchPreferenceCompat
|
||||
app:key="Main/SyncToHostRefreshRate"
|
||||
app:title="@string/settings_general_sync_to_host_refresh_rate"
|
||||
app:defaultValue="false"
|
||||
app:summary="@string/settings_summary_general_sync_to_host_refresh_rate"
|
||||
app:dependency="Display/VSync"
|
||||
app:iconSpaceReserved="false" />
|
||||
<ListPreference
|
||||
app:key="Console/Region"
|
||||
app:title="@string/settings_console_region"
|
||||
|
Reference in New Issue
Block a user