renderer: Add disable right eye performance hack

This commit is contained in:
PabloMK7
2024-11-14 20:11:58 +01:00
committed by OpenSauce04
parent 189dccda83
commit 758ded7fae
43 changed files with 590 additions and 168 deletions

View File

@@ -63,7 +63,8 @@ enum class IntSetting(
USE_FRAME_LIMIT("use_frame_limit", Settings.SECTION_RENDERER, 1),
DELAY_RENDER_THREAD_US("delay_game_render_thread_us", Settings.SECTION_RENDERER, 0),
USE_ARTIC_BASE_CONTROLLER("use_artic_base_controller", Settings.SECTION_CONTROLS, 0),
ORIENTATION_OPTION("screen_orientation", Settings.SECTION_LAYOUT, 2);
ORIENTATION_OPTION("screen_orientation", Settings.SECTION_LAYOUT, 2),
DISABLE_RIGHT_EYE_RENDER("disable_right_eye_render", Settings.SECTION_RENDERER, 1);
override var int: Int = defaultValue
override val valueAsString: String
@@ -91,7 +92,8 @@ enum class IntSetting(
CPU_JIT,
ASYNC_CUSTOM_LOADING,
AUDIO_INPUT_TYPE,
USE_ARTIC_BASE_CONTROLLER
USE_ARTIC_BASE_CONTROLLER,
SHADERS_ACCURATE_MUL,
)
fun from(key: String): IntSetting? = IntSetting.values().firstOrNull { it.key == key }

View File

@@ -847,6 +847,15 @@ class SettingsFragmentPresenter(private val fragmentView: SettingsFragmentView)
IntSetting.STEREOSCOPIC_3D_DEPTH.defaultValue.toFloat()
)
)
add(
SwitchSetting(
IntSetting.DISABLE_RIGHT_EYE_RENDER,
R.string.disable_right_eye_render,
R.string.use_disk_shader_cache_description,
IntSetting.DISABLE_RIGHT_EYE_RENDER.key,
IntSetting.DISABLE_RIGHT_EYE_RENDER.defaultValue
)
)
add(HeaderSetting(R.string.cardboard_vr))
add(

View File

@@ -1138,9 +1138,10 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback, Choreographer.Fram
val perfStats = NativeLibrary.getPerfStats()
if (perfStats[FPS] > 0) {
binding.showFpsText.text = String.format(
"FPS: %d Speed: %d%%",
"FPS: %d Speed: %d%% FT: %.2fms",
(perfStats[FPS] + 0.5).toInt(),
(perfStats[SPEED] * 100.0 + 0.5).toInt()
(perfStats[SPEED] * 100.0 + 0.5).toInt(),
(perfStats[FRAMETIME] * 1000.0f).toFloat()
)
}
perfStatsUpdateHandler.postDelayed(perfStatsUpdater!!, 3000)

View File

@@ -20,8 +20,6 @@ add_library(citra-android SHARED
emu_window/emu_window.cpp
emu_window/emu_window.h
game_info.cpp
game_settings.cpp
game_settings.h
id_cache.cpp
id_cache.h
native.cpp

View File

@@ -172,6 +172,7 @@ void Config::ReadValues() {
ReadSetting("Renderer", Settings::values.bg_green);
ReadSetting("Renderer", Settings::values.bg_blue);
ReadSetting("Renderer", Settings::values.delay_game_render_thread_us);
ReadSetting("Renderer", Settings::values.disable_right_eye_render);
// Layout
// Somewhat inelegant solution to ensure layout value is between 0 and 5 on read

View File

@@ -182,6 +182,11 @@ filter_mode =
# Set to 0 for no delay, only useful in dynamic-fps games to simulate GPU delay.
delay_game_render_thread_us =
# Disables rendering the right eye image.
# Greatly improves performance in some games, but can cause flickering in others.
# 0: Enable right eye rendering, 1 (default): Disable right eye rendering
disable_right_eye_render =
[Layout]
# Layout for the screen inside the render window, landscape mode
# 0: Original (screens vertically aligned)

View File

@@ -1,45 +0,0 @@
// Copyright 2019 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/settings.h"
namespace GameSettings {
void LoadOverrides(u64 program_id) {
switch (program_id) {
// JAP / The Legend of Zelda: Ocarina of Time 3D
case 0x0004000000033400:
// USA / The Legend of Zelda: Ocarina of Time 3D
case 0x0004000000033500:
// EUR / The Legend of Zelda: Ocarina of Time 3D
case 0x0004000000033600:
// KOR / The Legend of Zelda: Ocarina of Time 3D
case 0x000400000008F800:
// CHI / The Legend of Zelda: Ocarina of Time 3D
case 0x000400000008F900:
// This game requires accurate multiplication to render properly
Settings::values.shaders_accurate_mul = true;
break;
// USA / Mario & Luigi: Superstar Saga + Bowsers Minions
case 0x00040000001B8F00:
// EUR / Mario & Luigi: Superstar Saga + Bowsers Minions
case 0x00040000001B9000:
// JAP / Mario & Luigi: Superstar Saga + Bowsers Minions
case 0x0004000000194B00:
// This game requires accurate multiplication to render properly
Settings::values.shaders_accurate_mul = true;
break;
// USA / Mario & Luigi: Bowsers Inside Story + Bowser Jrs Journey
case 0x00040000001D1400:
// EUR / Mario & Luigi: Bowsers Inside Story + Bowser Jrs Journey
case 0x00040000001D1500:
// This game requires accurate multiplication to render properly
Settings::values.shaders_accurate_mul = true;
break;
}
}
} // namespace GameSettings

View File

@@ -1,11 +0,0 @@
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/common_types.h"
namespace GameSettings {
void LoadOverrides(u64 program_id);
} // namespace GameSettings

View File

@@ -50,7 +50,6 @@
#ifdef ENABLE_VULKAN
#include "jni/emu_window/emu_window_vk.h"
#endif
#include "jni/game_settings.h"
#include "jni/id_cache.h"
#include "jni/input_manager.h"
#include "jni/ndk_motion.h"
@@ -181,7 +180,6 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
if (app_loader) {
app_loader->ReadProgramId(program_id);
system.RegisterAppLoaderEarly(app_loader);
GameSettings::LoadOverrides(program_id);
}
system.ApplySettings();
Settings::LogSettings();
@@ -624,7 +622,6 @@ void Java_org_citra_citra_1emu_NativeLibrary_reloadSettings([[maybe_unused]] JNI
if (system.IsPoweredOn()) {
u64 program_id{};
system.GetAppLoader().ReadProgramId(program_id);
GameSettings::LoadOverrides(program_id);
}
system.ApplySettings();

View File

@@ -671,5 +671,7 @@ Se esperan fallos gráficos temporales cuando ésta esté activado.</string>
<string name="miscellaneous">Misceláneo</string>
<string name="use_artic_base_controller">Usar Artic Controller cuando se está conectado a Artic Base Server</string>
<string name="use_artic_base_controller_desc">Usa los controles proporcionados por Artic Base Server cuando esté conectado a él en lugar del dispositivo de entrada configurado.</string>
<string name="disable_right_eye_render">Desactivar dibujado de ojo derecho</string>
<string name="disable_right_eye_render_desc">Mejora considerablemente el rendimiento en algunos juegos, pero puede producir parpadeos en otros.</string>
</resources>

View File

@@ -782,5 +782,7 @@
<string name="use_artic_base_controller_desc">Use the controls provided by Artic Base Server when connected to it instead of the configured input device.</string>
<string name="instant_debug_log">Flush log output on every message</string>
<string name="instant_debug_log_desc">Immediately commits the debug log to file. Use this if citra crashes and the log output is being cut.</string>
<string name="disable_right_eye_render">Disable Right Eye Render</string>
<string name="disable_right_eye_render_desc">Greatly improves performance in some games, but can cause flickering in others.</string>
</resources>