[Android] Add aspect ratio

This commit is contained in:
zilmar 2017-04-29 19:02:25 +10:00
parent 05cd6eac3c
commit b4505f2215
5 changed files with 39 additions and 14 deletions

View File

@ -125,6 +125,12 @@
<string name="LimitFPS_title">Limit FPS</string>
<string name="screenResolution_title">Rendered Resolution</string>
<string name="screenResolution_summary">should show value???</string>
<string name="AspectRatio_title">Aspect ratio</string>
<string name="AspectRatio_summary">Select the display aspect ratio</string>
<string name="AspectRatio_4x3">4:3 (default)</string>
<string name="AspectRatio_16x9">Force 16:9</string>
<string name="AspectRatio_Stretch">Stretch</string>
<string name="AspectRatio_Original">Original</string>
<string name="DisplaySpeed_title">Display Speed</string>
<string name="DisplaySpeed_summary">Show the speed of the emulation</string>
<string name="DisplaySpeedDisplay">Display Speed Display</string>
@ -157,7 +163,18 @@
<item>2</item>
<item>0</item>
</string-array>
<string-array name="AspectRatio_list">
<item>@string/AspectRatio_4x3</item>
<item>@string/AspectRatio_16x9</item>
<item>@string/AspectRatio_Stretch</item>
<item>@string/AspectRatio_Original</item>
</string-array>
<string-array name="AspectRatio_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string-array name="cpu_core_list">
<item>@string/Interpreter</item>
<item>@string/Recompiler</item>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:tag="unique_tag">
<emu.project64.settings.TwoLinesListPreference
android:defaultValue="0"
@ -7,6 +7,12 @@
android:title="@string/screenResolution_title"
android:summary="@string/screenResolution_summary"
android:dialogTitle="@string/screenResolution_title" />
<ListPreference
android:entries="@array/AspectRatio_list"
android:entryValues="@array/AspectRatio_values"
android:key="video_AspectRatio"
android:title="@string/AspectRatio_title"
android:summary="@string/AspectRatio_summary" />
<CheckBoxPreference
android:key="Debugger_DisplaySpeed"
android:summary="@string/DisplaySpeed_summary"

View File

@ -135,6 +135,10 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat
{
loadFragment(new LoggingProject64Core());
}
else if (preference.getKey().equals("logging_video"))
{
loadFragment(new LoggingVideo());
}
else if (preference.getKey().equals("logging_audio"))
{
loadFragment(new LoggingAudio());

View File

@ -107,6 +107,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
.putString("Debugger_TraceAudioInitShutdown",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInitShutdown.getValue())))
.putString("Debugger_TraceAudioAudioInterface",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInterface.getValue())))
.putString("video_screenResolution",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstGfxSettings.getValue() + VideoSettingID.Set_Resolution.getValue())))
.putString("video_AspectRatio",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.FirstGfxSettings.getValue() + VideoSettingID.Set_aspect.getValue())))
.putInt("MaxRomsRemembered",NativeExports.UISettingsLoadDword(UISettingID.File_RecentGameFileCount.getValue()))
.apply();
@ -204,6 +205,12 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
else if (key.equals("Debugger_TraceAudioInitShutdown")) { NativeExports.SettingsSaveDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInitShutdown.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("Debugger_TraceAudioAudioInterface")) { NativeExports.SettingsSaveDword(SettingsID.FirstAudioSettings.getValue() + AudioSettingID.Logging_LogAudioInterface.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("video_screenResolution")) { NativeExports.SettingsSaveDword(SettingsID.FirstGfxSettings.getValue() + VideoSettingID.Set_Resolution.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("video_AspectRatio"))
{
NativeExports.SettingsSaveDword(SettingsID.FirstGfxSettings.getValue() + VideoSettingID.Set_aspect.getValue(), Integer.valueOf(sharedPreferences.getString(key, "0")));
getSupportFragmentManager().popBackStackImmediate();
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_placeholder, new VideoFragment()).addToBackStack("main").commit();
}
else if (key.equals("MaxRomsRemembered")) { NativeExports.UISettingsSaveDword(UISettingID.File_RecentGameFileCount.getValue(), sharedPreferences.getInt(key, 10)); }
}
}

View File

@ -10,18 +10,11 @@
****************************************************************************/
package emu.project64.settings;
import android.content.Context;
import android.graphics.Point;
import android.os.Build;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager;
import emu.project64.AndroidDevice;
import emu.project64.R;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeVideo;
import emu.project64.util.Strings;
public class VideoFragment extends BaseSettingsFragment
{
@ -42,6 +35,9 @@ public class VideoFragment extends BaseSettingsFragment
{
super.onCreatePreferences(bundle, s);
Log.d("VideoFragment", "onCreatePreferences");
NativeVideo.UpdateScreenRes(AndroidDevice.nativeWidth, AndroidDevice.nativeHeight);
int ResCount = NativeVideo.getResolutionCount();
CharSequence[] ResEntries = new CharSequence[ResCount];
String[] ResEntryValues = new String[ResCount];
@ -52,11 +48,6 @@ public class VideoFragment extends BaseSettingsFragment
ResEntries[i] = NativeVideo.getResolutionName(i);
ResEntryValues[i] = Integer.toString(i);
ResEntrySubtitles[i] = "";
if (ResEntries[i].equals("#3200#"))
{
ResEntries[i] = Strings.GetString(LanguageStringID.ANDROID_VIDEO_NATIVE_RES);
ResEntrySubtitles[i] = AndroidDevice.nativeWidth+"x"+AndroidDevice.nativeHeight;
}
}
final TwoLinesListPreference listPreference = (TwoLinesListPreference) findPreference("video_screenResolution");