citra_qt: Add enhancement options to per-game (#6308)

Co-authored-by: Tobias <thm.frey@gmail.com>
This commit is contained in:
GPUCode 2023-03-21 23:12:13 +02:00 committed by GitHub
parent fbf53686c3
commit 0c3fe272b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 421 additions and 258 deletions

View file

@ -20,6 +20,17 @@
namespace Settings {
std::string_view GetAudioEmulationName(AudioEmulation emulation) {
switch (emulation) {
case AudioEmulation::HLE:
return "HLE";
case AudioEmulation::LLE:
return "LLE";
case AudioEmulation::LLEMultithreaded:
return "LLE Multithreaded";
}
};
Values values = {};
static bool configuring_global = true;
@ -86,17 +97,6 @@ void LogSettings() {
LOG_INFO(Config, "{}: {}", name, value);
};
const auto to_string = [](AudioEmulation emulation) -> std::string_view {
switch (emulation) {
case AudioEmulation::HLE:
return "HLE";
case AudioEmulation::LLE:
return "LLE";
case AudioEmulation::LLEMultithreaded:
return "LLE Multithreaded";
}
};
LOG_INFO(Config, "Citra Configuration:");
log_setting("Core_UseCpuJit", values.use_cpu_jit.GetValue());
log_setting("Core_CPUClockPercentage", values.cpu_clock_percentage.GetValue());
@ -125,7 +125,7 @@ void LogSettings() {
log_setting("Utility_DumpTextures", values.dump_textures.GetValue());
log_setting("Utility_CustomTextures", values.custom_textures.GetValue());
log_setting("Utility_UseDiskShaderCache", values.use_disk_shader_cache.GetValue());
log_setting("Audio_Emulation", to_string(values.audio_emulation.GetValue()));
log_setting("Audio_Emulation", GetAudioEmulationName(values.audio_emulation.GetValue()));
log_setting("Audio_OutputEngine", values.sink_id.GetValue());
log_setting("Audio_EnableAudioStretching", values.enable_audio_stretching.GetValue());
log_setting("Audio_OutputDevice", values.audio_device_id.GetValue());
@ -207,6 +207,9 @@ void RestoreGlobalState(bool is_powered_on) {
values.filter_mode.SetGlobal(true);
values.pp_shader_name.SetGlobal(true);
values.anaglyph_shader_name.SetGlobal(true);
values.dump_textures.SetGlobal(true);
values.custom_textures.SetGlobal(true);
values.preload_textures.SetGlobal(true);
}
void LoadProfile(int index) {

View file

@ -54,9 +54,16 @@ enum class StereoRenderOption : u32 {
// Which eye to render when 3d is off. 800px wide mode could be added here in the future, when
// implemented
enum class MonoRenderOption : u32 { LeftEye = 0, RightEye = 1 };
enum class MonoRenderOption : u32 {
LeftEye = 0,
RightEye = 1,
};
enum class AudioEmulation : u32 { HLE = 0, LLE = 1, LLEMultithreaded = 2 };
enum class AudioEmulation : u32 {
HLE = 0,
LLE = 1,
LLEMultithreaded = 2,
};
namespace NativeButton {
@ -361,38 +368,6 @@ protected:
Type custom{}; ///< The custom value of the setting
};
/**
* The InputSetting class allows for getting a reference to either the global or custom members.
* This is required as we cannot easily modify the values of user-defined types within containers
* using the SetValue() member function found in the Setting class. The primary purpose of this
* class is to store an array of 10 PlayerInput structs for both the global and custom setting and
* allows for easily accessing and modifying both settings.
*/
template <typename Type>
class InputSetting final {
public:
InputSetting() = default;
explicit InputSetting(Type val) : Setting<Type>(val) {}
~InputSetting() = default;
void SetGlobal(bool to_global) {
use_global = to_global;
}
[[nodiscard]] bool UsingGlobal() const {
return use_global;
}
[[nodiscard]] Type& GetValue(bool need_global = false) {
if (use_global || need_global) {
return global;
}
return custom;
}
private:
bool use_global{true}; ///< The setting's global state
Type global{}; ///< The setting
Type custom{}; ///< The custom setting value
};
struct InputProfile {
std::string name;
std::array<std::string, NativeButton::NumButtons> buttons;
@ -485,9 +460,9 @@ struct Values {
SwitchableSetting<std::string> pp_shader_name{"none (builtin)", "pp_shader_name"};
SwitchableSetting<std::string> anaglyph_shader_name{"dubois (builtin)", "anaglyph_shader_name"};
Setting<bool> dump_textures{false, "dump_textures"};
Setting<bool> custom_textures{false, "custom_textures"};
Setting<bool> preload_textures{false, "preload_textures"};
SwitchableSetting<bool> dump_textures{false, "dump_textures"};
SwitchableSetting<bool> custom_textures{false, "custom_textures"};
SwitchableSetting<bool> preload_textures{false, "preload_textures"};
// Audio
bool audio_muted;