mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-09 19:23:18 -06:00
even more settings
This commit is contained in:
parent
8d202e5bff
commit
153618c1a4
@ -154,10 +154,6 @@ static ConfigEntry<bool> useUnifiedInputConfig(true);
|
||||
static ConfigEntry<string> defaultControllerID("");
|
||||
static ConfigEntry<bool> backgroundControllerInput(false);
|
||||
|
||||
static ConfigEntry<bool> shouldDumpShaders(false);
|
||||
static ConfigEntry<bool> shouldPatchShaders(false);
|
||||
static ConfigEntry<u32> vblankFrequency(60);
|
||||
|
||||
// Debug
|
||||
static ConfigEntry<bool> isFpsColor(true);
|
||||
static ConfigEntry<bool> showFpsCounter(false);
|
||||
@ -255,13 +251,7 @@ bool getIsMotionControlsEnabled() {
|
||||
return isMotionControlsEnabled.get();
|
||||
}
|
||||
|
||||
bool dumpShaders() {
|
||||
return shouldDumpShaders.get();
|
||||
}
|
||||
|
||||
bool patchShaders() {
|
||||
return shouldPatchShaders.get();
|
||||
}
|
||||
|
||||
bool fpsColor() {
|
||||
return isFpsColor.get();
|
||||
@ -275,21 +265,6 @@ void setShowFpsCounter(bool enable, bool is_game_specific) {
|
||||
showFpsCounter.set(enable, is_game_specific);
|
||||
}
|
||||
|
||||
u32 vblankFreq() {
|
||||
if (vblankFrequency.get() < 60) {
|
||||
vblankFrequency = 60;
|
||||
}
|
||||
return vblankFrequency.get();
|
||||
}
|
||||
|
||||
void setDumpShaders(bool enable, bool is_game_specific) {
|
||||
shouldDumpShaders.set(enable, is_game_specific);
|
||||
}
|
||||
|
||||
void setVblankFreq(u32 value, bool is_game_specific) {
|
||||
vblankFrequency.set(value, is_game_specific);
|
||||
}
|
||||
|
||||
void setCursorState(s16 newCursorState, bool is_game_specific) {
|
||||
cursorState.set(newCursorState, is_game_specific);
|
||||
}
|
||||
@ -392,13 +367,6 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
|
||||
usbDeviceBackend.setFromToml(input, "usbDeviceBackend", is_game_specific);
|
||||
}
|
||||
|
||||
if (data.contains("GPU")) {
|
||||
const toml::value& gpu = data.at("GPU");
|
||||
shouldDumpShaders.setFromToml(gpu, "dumpShaders", is_game_specific);
|
||||
shouldPatchShaders.setFromToml(gpu, "patchShaders", is_game_specific);
|
||||
vblankFrequency.setFromToml(gpu, "vblankFrequency", is_game_specific);
|
||||
}
|
||||
|
||||
string current_version = {};
|
||||
if (data.contains("Debug")) {
|
||||
const toml::value& debug = data.at("Debug");
|
||||
@ -487,8 +455,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
|
||||
is_game_specific);
|
||||
usbDeviceBackend.setTomlValue(data, "Input", "usbDeviceBackend", is_game_specific);
|
||||
|
||||
shouldDumpShaders.setTomlValue(data, "GPU", "dumpShaders", is_game_specific);
|
||||
vblankFrequency.setTomlValue(data, "GPU", "vblankFrequency", is_game_specific);
|
||||
|
||||
m_language.setTomlValue(data, "Settings", "consoleLanguage", is_game_specific);
|
||||
|
||||
@ -502,7 +468,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
|
||||
data["Input"]["useSpecialPad"] = useSpecialPad.base_value;
|
||||
data["Input"]["specialPadClass"] = specialPadClass.base_value;
|
||||
data["Input"]["useUnifiedInputConfig"] = useUnifiedInputConfig.base_value;
|
||||
data["GPU"]["patchShaders"] = shouldPatchShaders.base_value;
|
||||
data["Debug"]["FPSColor"] = isFpsColor.base_value;
|
||||
data["Debug"]["showFpsCounter"] = showFpsCounter.base_value;
|
||||
}
|
||||
@ -532,10 +497,6 @@ void setDefaultValues(bool is_game_specific) {
|
||||
backgroundControllerInput.setDefault(is_game_specific);
|
||||
usbDeviceBackend.setDefault(is_game_specific);
|
||||
|
||||
// GS - GPU
|
||||
shouldDumpShaders.setDefault(is_game_specific);
|
||||
vblankFrequency.setDefault(is_game_specific);
|
||||
|
||||
// GS - Settings
|
||||
m_language.setDefault(is_game_specific);
|
||||
|
||||
@ -549,8 +510,6 @@ void setDefaultValues(bool is_game_specific) {
|
||||
controllerCustomColorRGB[1] = 0;
|
||||
controllerCustomColorRGB[2] = 255;
|
||||
|
||||
// GPU
|
||||
shouldPatchShaders.base_value = false;
|
||||
// Debug
|
||||
isFpsColor.base_value = true;
|
||||
showFpsCounter.base_value = false;
|
||||
|
||||
@ -31,10 +31,6 @@ int getVolumeSlider();
|
||||
void setVolumeSlider(int volumeValue, bool is_game_specific = false);
|
||||
std::string getTrophyKey();
|
||||
void setTrophyKey(std::string key);
|
||||
bool dumpShaders();
|
||||
void setDumpShaders(bool enable, bool is_game_specific = false);
|
||||
u32 vblankFreq();
|
||||
void setVblankFreq(u32 value, bool is_game_specific = false);
|
||||
s16 getCursorState();
|
||||
void setCursorState(s16 cursorState, bool is_game_specific = false);
|
||||
int getCursorHideTimeout();
|
||||
@ -45,7 +41,6 @@ void setUseSpecialPad(bool use);
|
||||
bool getUseSpecialPad();
|
||||
void setSpecialPadClass(int type);
|
||||
int getSpecialPadClass();
|
||||
bool patchShaders(); // no set
|
||||
bool fpsColor(); // no set
|
||||
bool getShowFpsCounter();
|
||||
void setShowFpsCounter(bool enable, bool is_game_specific = false);
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include "common/config.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/debug_state.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
@ -29,7 +30,7 @@ void FrameGraph::DrawFrameGraph() {
|
||||
return;
|
||||
}
|
||||
|
||||
float target_dt = 1.0f / (float)Config::vblankFreq();
|
||||
float target_dt = 1.0f / (float)EmulatorSettings::GetInstance()->GetVblankFrequency();
|
||||
float cur_pos_x = pos.x + full_width;
|
||||
pos.y += FRAME_GRAPH_PADDING_Y;
|
||||
const float final_pos_y = pos.y + FRAME_GRAPH_HEIGHT;
|
||||
|
||||
@ -377,6 +377,11 @@ public:
|
||||
void Set##Name(const decltype(group.field.value)& v) { \
|
||||
group.field.value = v; \
|
||||
}
|
||||
#define SETTING_FORWARD_BOOL_READONLY(group, Name, field) \
|
||||
auto Is##Name() const { \
|
||||
return group.field.value; \
|
||||
}
|
||||
|
||||
// General settings
|
||||
SETTING_FORWARD(m_general, VolumeSlider, volume_slider)
|
||||
SETTING_FORWARD_BOOL(m_general, Neo, neo_mode)
|
||||
@ -422,7 +427,21 @@ public:
|
||||
SETTING_FORWARD_BOOL(m_gpu, ReadbacksEnabled, readbacks_enabled)
|
||||
SETTING_FORWARD_BOOL(m_gpu, ReadbackLinearImagesEnabled, readback_linear_images_enabled)
|
||||
SETTING_FORWARD_BOOL(m_gpu, DirectMemoryAccessEnabled, direct_memory_access_enabled)
|
||||
SETTING_FORWARD(m_gpu, VblankFrequency, vblank_frequency)
|
||||
SETTING_FORWARD_BOOL_READONLY(m_gpu, PatchShaders, patch_shaders)
|
||||
|
||||
u32 GetVblankFrequency() {
|
||||
if (m_gpu.vblank_frequency.value < 60) {
|
||||
m_gpu.vblank_frequency.value = 60;
|
||||
}
|
||||
return m_gpu.vblank_frequency.value;
|
||||
}
|
||||
void SetVblankFrequency(const u32& v) {
|
||||
if (v < 60) {
|
||||
m_gpu.vblank_frequency.value = 60;
|
||||
} else {
|
||||
m_gpu.vblank_frequency.value = v;
|
||||
}
|
||||
}
|
||||
|
||||
// Input Settings
|
||||
SETTING_FORWARD(m_input, CursorState, cursor_state)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/assert.h"
|
||||
@ -12,6 +12,7 @@
|
||||
#include "imgui/renderer/imgui_core.h"
|
||||
#include "video_core/amdgpu/liverpool.h"
|
||||
#include "video_core/renderer_vulkan/vk_presenter.h"
|
||||
#include "core/emulator_settings.h"
|
||||
|
||||
extern std::unique_ptr<Vulkan::Presenter> presenter;
|
||||
extern std::unique_ptr<AmdGpu::Liverpool> liverpool;
|
||||
@ -267,7 +268,7 @@ void VideoOutDriver::SubmitFlipInternal(VideoOutPort* port, s32 index, s64 flip_
|
||||
}
|
||||
|
||||
void VideoOutDriver::PresentThread(std::stop_token token) {
|
||||
const std::chrono::nanoseconds vblank_period(1000000000 / Config::vblankFreq());
|
||||
const std::chrono::nanoseconds vblank_period(1000000000 / EmulatorSettings::GetInstance()->GetVblankFrequency());
|
||||
|
||||
Common::SetCurrentThreadName("shadPS4:PresentThread");
|
||||
Common::SetCurrentThreadRealtime(vblank_period);
|
||||
|
||||
@ -218,8 +218,9 @@ void Emulator::Run(std::filesystem::path file, std::vector<std::string> args,
|
||||
EmulatorSettings::GetInstance()->IsReadbackLinearImagesEnabled());
|
||||
LOG_INFO(Config, "GPU directMemoryAccess: {}",
|
||||
EmulatorSettings::GetInstance()->IsDirectMemoryAccessEnabled());
|
||||
LOG_INFO(Config, "GPU shouldDumpShaders: {}", Config::dumpShaders());
|
||||
LOG_INFO(Config, "GPU vblankFrequency: {}", Config::vblankFreq());
|
||||
LOG_INFO(Config, "GPU shouldDumpShaders: {}", EmulatorSettings::GetInstance()->IsDumpShaders());
|
||||
LOG_INFO(Config, "GPU vblankFrequency: {}",
|
||||
EmulatorSettings::GetInstance()->GetVblankFrequency());
|
||||
LOG_INFO(Config, "GPU shouldCopyGPUBuffers: {}",
|
||||
EmulatorSettings::GetInstance()->IsCopyGpuBuffers());
|
||||
LOG_INFO(Config, "Vulkan gpuId: {}", EmulatorSettings::GetInstance()->GetGpuId());
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/config.h"
|
||||
#include "common/io_file.h"
|
||||
#include "common/path_util.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "shader_recompiler/frontend/decode.h"
|
||||
#include "shader_recompiler/frontend/fetch_shader.h"
|
||||
#include "shader_recompiler/frontend/translate/translate.h"
|
||||
@ -552,7 +553,7 @@ void Translator::EmitFetch(const GcnInst& inst) {
|
||||
const auto fetch_data = ParseFetchShader(info);
|
||||
ASSERT(fetch_data.has_value());
|
||||
|
||||
if (Config::dumpShaders()) {
|
||||
if (EmulatorSettings::GetInstance()->IsDumpShaders()) {
|
||||
using namespace Common::FS;
|
||||
const auto dump_dir = GetUserPath(PathType::ShaderDir) / "dumps";
|
||||
if (!std::filesystem::exists(dump_dir)) {
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <unordered_map>
|
||||
@ -11,6 +10,7 @@
|
||||
#include "common/logging/log.h"
|
||||
#include "common/path_util.h"
|
||||
#include "common/signal_context.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "core/signals.h"
|
||||
#include "shader_recompiler/info.h"
|
||||
#include "shader_recompiler/ir/breadth_first_search.h"
|
||||
@ -229,7 +229,7 @@ static void GenerateSrtProgram(Info& info, PassInfo& pass_info) {
|
||||
info.srt_info.walker_func_size =
|
||||
c.getCurr() - reinterpret_cast<const u8*>(info.srt_info.walker_func);
|
||||
|
||||
if (Config::dumpShaders()) {
|
||||
if (EmulatorSettings::GetInstance()->IsDumpShaders()) {
|
||||
DumpSrtProgram(info, reinterpret_cast<const u8*>(info.srt_info.walker_func),
|
||||
info.srt_info.walker_func_size);
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <map>
|
||||
@ -9,6 +10,7 @@
|
||||
#include "common/config.h"
|
||||
#include "common/io_file.h"
|
||||
#include "common/path_util.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "shader_recompiler/ir/basic_block.h"
|
||||
#include "shader_recompiler/ir/program.h"
|
||||
#include "shader_recompiler/ir/value.h"
|
||||
@ -18,7 +20,7 @@ namespace Shader::IR {
|
||||
void DumpProgram(const Program& program, const Info& info, const std::string& type) {
|
||||
using namespace Common::FS;
|
||||
|
||||
if (!Config::dumpShaders()) {
|
||||
if (!EmulatorSettings::GetInstance()->IsDumpShaders()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -544,7 +544,7 @@ vk::ShaderModule PipelineCache::CompileModule(Shader::Info& info, Shader::Runtim
|
||||
vk::ShaderModule module;
|
||||
|
||||
auto patch = GetShaderPatch(info.pgm_hash, info.stage, perm_idx, "spv");
|
||||
const bool is_patched = patch && Config::patchShaders();
|
||||
const bool is_patched = patch && EmulatorSettings::GetInstance()->IsPatchShaders();
|
||||
if (is_patched) {
|
||||
LOG_INFO(Loader, "Loaded patch for {} shader {:#x}", info.stage, info.pgm_hash);
|
||||
module = CompileSPV(*patch, instance.GetDevice());
|
||||
@ -649,7 +649,7 @@ std::string PipelineCache::GetShaderName(Shader::Stage stage, u64 hash,
|
||||
|
||||
void PipelineCache::DumpShader(std::span<const u32> code, u64 hash, Shader::Stage stage,
|
||||
size_t perm_idx, std::string_view ext) {
|
||||
if (!Config::dumpShaders()) {
|
||||
if (!EmulatorSettings::GetInstance()->IsDumpShaders()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user