android: Frontend: Fix rendering aspect ratio & add a setting for it.

This commit is contained in:
bunnei 2023-01-23 16:44:05 -08:00
parent 4f903d8d35
commit 6cc21a56d9
7 changed files with 25 additions and 2 deletions

View file

@ -159,11 +159,13 @@ public final class SettingsFragmentPresenter {
Setting rendererBackend = rendererSection.getSetting(SettingsFile.KEY_RENDERER_BACKEND); Setting rendererBackend = rendererSection.getSetting(SettingsFile.KEY_RENDERER_BACKEND);
Setting rendererAccuracy = rendererSection.getSetting(SettingsFile.KEY_RENDERER_ACCURACY); Setting rendererAccuracy = rendererSection.getSetting(SettingsFile.KEY_RENDERER_ACCURACY);
Setting rendererReolution = rendererSection.getSetting(SettingsFile.KEY_RENDERER_RESOLUTION); Setting rendererReolution = rendererSection.getSetting(SettingsFile.KEY_RENDERER_RESOLUTION);
Setting rendererAspectRation = rendererSection.getSetting(SettingsFile.KEY_RENDERER_ASPECT_RATIO);
Setting rendererAsynchronousShaders = rendererSection.getSetting(SettingsFile.KEY_RENDERER_ASYNCHRONOUS_SHADERS); Setting rendererAsynchronousShaders = rendererSection.getSetting(SettingsFile.KEY_RENDERER_ASYNCHRONOUS_SHADERS);
sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_BACKEND, Settings.SECTION_RENDERER, R.string.renderer_api, 0, R.array.rendererApiNames, R.array.rendererApiValues, 0, rendererBackend)); sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_BACKEND, Settings.SECTION_RENDERER, R.string.renderer_api, 0, R.array.rendererApiNames, R.array.rendererApiValues, 0, rendererBackend));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_ACCURACY, Settings.SECTION_RENDERER, R.string.renderer_accuracy, 0, R.array.rendererAccuracyNames, R.array.rendererAccuracyValues, 1, rendererAccuracy)); sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_ACCURACY, Settings.SECTION_RENDERER, R.string.renderer_accuracy, 0, R.array.rendererAccuracyNames, R.array.rendererAccuracyValues, 1, rendererAccuracy));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_RESOLUTION, Settings.SECTION_RENDERER, R.string.renderer_resolution, 0, R.array.rendererResolutionNames, R.array.rendererResolutionValues, 2, rendererReolution)); sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_RESOLUTION, Settings.SECTION_RENDERER, R.string.renderer_resolution, 0, R.array.rendererResolutionNames, R.array.rendererResolutionValues, 2, rendererReolution));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_RENDERER_ASPECT_RATIO, Settings.SECTION_RENDERER, R.string.renderer_aspect_ratio, 0, R.array.rendererAspectRatioNames, R.array.rendererAspectRatioValues, 0, rendererAspectRation));
sl.add(new CheckBoxSetting(SettingsFile.KEY_RENDERER_ASYNCHRONOUS_SHADERS, Settings.SECTION_RENDERER, R.string.renderer_asynchronous_shaders, R.string.renderer_asynchronous_shaders_description, false, rendererAsynchronousShaders)); sl.add(new CheckBoxSetting(SettingsFile.KEY_RENDERER_ASYNCHRONOUS_SHADERS, Settings.SECTION_RENDERER, R.string.renderer_asynchronous_shaders, R.string.renderer_asynchronous_shaders_description, false, rendererAsynchronousShaders));
} }

View file

@ -44,6 +44,7 @@ public final class SettingsFile {
public static final String KEY_RENDERER_BACKEND = "backend"; public static final String KEY_RENDERER_BACKEND = "backend";
// Renderer // Renderer
public static final String KEY_RENDERER_RESOLUTION = "resolution_setup"; public static final String KEY_RENDERER_RESOLUTION = "resolution_setup";
public static final String KEY_RENDERER_ASPECT_RATIO = "aspect_ratio";
public static final String KEY_RENDERER_ACCURACY = "gpu_accuracy"; public static final String KEY_RENDERER_ACCURACY = "gpu_accuracy";
public static final String KEY_RENDERER_ASYNCHRONOUS_SHADERS = "use_asynchronous_shaders"; public static final String KEY_RENDERER_ASYNCHRONOUS_SHADERS = "use_asynchronous_shaders";
public static final String KEY_RENDERER_USE_SPEED_LIMIT = "use_speed_limit"; public static final String KEY_RENDERER_USE_SPEED_LIMIT = "use_speed_limit";

View file

@ -294,7 +294,7 @@ anti_aliasing =
fullscreen_mode = fullscreen_mode =
# Aspect ratio # Aspect ratio
# 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Stretch to Window # 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Force 16:10, 4: Stretch to Window
aspect_ratio = aspect_ratio =
# Anisotropic filtering # Anisotropic filtering

View file

@ -46,6 +46,9 @@ EmuWindow_Android::EmuWindow_Android(InputCommon::InputSubsystem* input_subsyste
window_width = ANativeWindow_getWidth(surface_); window_width = ANativeWindow_getWidth(surface_);
window_height = ANativeWindow_getHeight(surface_); window_height = ANativeWindow_getHeight(surface_);
// Ensures that we emulate with the correct aspect ratio.
UpdateCurrentFramebufferLayout(window_width, window_height);
host_window = surface_; host_window = surface_;
window_info.type = Core::Frontend::WindowSystemType::Android; window_info.type = Core::Frontend::WindowSystemType::Android;
window_info.render_surface = reinterpret_cast<void*>(host_window); window_info.render_surface = reinterpret_cast<void*>(host_window);

View file

@ -140,6 +140,22 @@
<item>5</item> <item>5</item>
</integer-array> </integer-array>
<string-array name="rendererAspectRatioNames">
<item>Default (16:9)</item>
<item>Force 4:3</item>
<item>Force 21:9</item>
<item>Force 16:10</item>
<item>Stretch to Window</item>
</string-array>
<integer-array name="rendererAspectRatioValues">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
</integer-array>
<string-array name="cpuAccuracyNames"> <string-array name="cpuAccuracyNames">
<item>Auto</item> <item>Auto</item>
<item>Accurate</item> <item>Accurate</item>

View file

@ -28,6 +28,7 @@
<string name="renderer_api">API</string> <string name="renderer_api">API</string>
<string name="renderer_accuracy">Accuracy level</string> <string name="renderer_accuracy">Accuracy level</string>
<string name="renderer_resolution">Resolution</string> <string name="renderer_resolution">Resolution</string>
<string name="renderer_aspect_ratio">Aspect Ratio</string>
<string name="renderer_asynchronous_shaders">Use asynchronous shaders</string> <string name="renderer_asynchronous_shaders">Use asynchronous shaders</string>
<string name="renderer_asynchronous_shaders_description">Compiles shaders asynchronously, which will reduce stutter but may introduce glitches.</string> <string name="renderer_asynchronous_shaders_description">Compiles shaders asynchronously, which will reduce stutter but may introduce glitches.</string>

View file

@ -318,7 +318,7 @@ anti_aliasing =
fullscreen_mode = fullscreen_mode =
# Aspect ratio # Aspect ratio
# 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Stretch to Window # 0: Default (16:9), 1: Force 4:3, 2: Force 21:9, 3: Force 16:10, 4: Stretch to Window
aspect_ratio = aspect_ratio =
# Anisotropic filtering # Anisotropic filtering