Vblank frequency setting fix + utf 8 encoding for paths (#4174)

* vblank frequency setting fix

* force utf-8 encoding upon json serialization/deserialization for path strings
This commit is contained in:
rainmakerv2 2026-03-26 06:13:43 +08:00 committed by GitHub
parent 3cc56bf84c
commit 650652db42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 10 deletions

View File

@ -25,10 +25,13 @@ namespace nlohmann {
template <>
struct adl_serializer<std::filesystem::path> {
static void to_json(json& j, const std::filesystem::path& p) {
j = p.string();
const auto u8 = p.u8string();
j = std::string(reinterpret_cast<const char*>(u8.data()), u8.size());
}
static void from_json(const json& j, std::filesystem::path& p) {
p = j.get<std::string>();
const std::string s = j.get<std::string>();
p = std::filesystem::path(
std::u8string_view(reinterpret_cast<const char8_t*>(s.data()), s.size()));
}
};
} // namespace nlohmann
@ -647,4 +650,4 @@ std::vector<std::string> EmulatorSettingsImpl::GetAllOverrideableKeys() const {
addGroup(m_gpu.GetOverrideableFields());
addGroup(m_vulkan.GetOverrideableFields());
return keys;
}
}

View File

@ -594,16 +594,17 @@ public:
SETTING_FORWARD_BOOL_READONLY(m_gpu, PatchShaders, patch_shaders)
u32 GetVblankFrequency() {
if (m_gpu.vblank_frequency.value < 60) {
m_gpu.vblank_frequency.value = 60;
if (m_gpu.vblank_frequency.value < 30) {
return 30;
}
return m_gpu.vblank_frequency.value;
return m_gpu.vblank_frequency.get();
}
void SetVblankFrequency(const u32& v) {
if (v < 60) {
m_gpu.vblank_frequency.value = 60;
void SetVblankFrequency(const u32& v, bool is_specific = false) {
u32 val = v < 30 ? 30 : v;
if (is_specific) {
m_gpu.vblank_frequency.game_specific_value = val;
} else {
m_gpu.vblank_frequency.value = v;
m_gpu.vblank_frequency.value = val;
}
}