mirror of
https://github.com/libretro/parallel-ps2.git
synced 2026-11-13 04:41:40 -10:00
Settings: the core options set Pcsx2Config directly; the string map is gone
Every core option went through a section/key map of strings on its way to the field it set: main.cpp wrote 71 values as strings into MemorySettingsInterface, and Pcsx2Config::LoadSave looked 139 entries up by string and parsed them back, at every ApplySettings. With it came a layered interface over the one layer, Host accessors over that, three default-writers that stored hardware-dependent defaults as strings for the same LoadSave to read, and readers in PAD, EmuFolders, CDVD, the OpenGL device and the gzip reader that looked up keys nothing wrote. main.cpp keeps a Pcsx2Config now, and each option handler assigns the field the key mapped to -- the mapping derived from the old LoadSave, not guessed, and checked after: all 71 handlers land on their mapped field, 67 in the config, EthApi as the enum value its name parsed to, and the BIOS path, fast boot and memory-card folder in three variables Host exposes. VMManager::LoadSettings copies that config and diffs old against new as it always did. Precedence is kept: the config starts from Pcsx2Config's defaults, VMManager::ApplyHardwareDefaults sets what SetHardwareDependentDefaultSettings set -- MTVU and affinity by core count, fastmem by platform -- and the options come after and win. The per-port controller type, which retro_set_controller_port_device wrote into the map for PAD::LoadConfig to read back, is a static PAD.cpp keeps. EmuFolders takes the memory-card folder and defaults the rest. What LoadSave did after reading was measured before it went: a default config round-tripped through an empty map equals a default config in every field an option can set, and the FPU control-register and DEV9 address blocks are identities on the defaults. The three things that are not -- the EECycleRate and EECycleSkip clamps and SkipDrawEnd never below SkipDrawStart -- are Pcsx2Config::ApplyOptionFixups, applied at LoadSettings. The map also emptied two string defaults the constructor sets, the memory-card names and the gzip index template; the first is overwritten from the content name on the same path as before, and the gzip reader took its template from the map with the same default, so neither changes. Gone: SettingsInterface.h, MemorySettingsInterface, SettingsWrapper, LayeredSettingsInterface and HostSettings.cpp, 1031 lines, and the USB declarations over SettingsInterface that had no definition. The orphaned tests/settings source that tested the map is replaced by a suite on the direct path: defaults unchanged by the fixups, the fixups clamping, the folder rules, and a BIOS path longer than its buffer cut and terminated -- the truncation the old test was for. Full default build links; all thirteen suites pass; every touched file is clean for Windows, macOS and iOS shapes with -Winfinite-recursion; no file references anything removed.
This commit is contained in:
1 parent
ff74c8d3f6
commit
0b7ca9035c
27 files changed
+246
-1737
No files matched your search
@@ -210,8 +210,6 @@ SOURCES_CXX += \
|
||||
$(COMMON_DIR)/Console.cpp \
|
||||
$(LRPS2_DIR)/HostFS.cpp \
|
||||
$(COMMON_DIR)/HostSys.cpp \
|
||||
$(COMMON_DIR)/MemorySettingsInterface.cpp \
|
||||
$(COMMON_DIR)/SettingsWrapper.cpp \
|
||||
$(COMMON_DIR)/StringUtil.cpp \
|
||||
|
||||
# common/emitter is the x86-only JIT code emitter. On aarch64 the recompilers
|
||||
@@ -323,8 +321,6 @@ SOURCES_CXX += \
|
||||
|
||||
# pcsx2/Frontend
|
||||
SOURCES_CXX += \
|
||||
$(LRPS2_DIR)/Frontend/HostSettings.cpp \
|
||||
$(LRPS2_DIR)/Frontend/LayeredSettingsInterface.cpp
|
||||
|
||||
# pcsx2/IPU
|
||||
SOURCES_CXX += \
|
||||
|
||||
@@ -9,8 +9,6 @@ add_library(common)
|
||||
|
||||
target_sources(common PRIVATE
|
||||
Console.cpp
|
||||
MemorySettingsInterface.cpp
|
||||
SettingsWrapper.cpp
|
||||
StringUtil.cpp
|
||||
HostSys.cpp
|
||||
)
|
||||
@@ -57,11 +55,8 @@ target_sources(common PRIVATE
|
||||
CpuFeatures.h
|
||||
General.h
|
||||
HashCombine.h
|
||||
MemorySettingsInterface.h
|
||||
RedtapeWilCom.h
|
||||
RedtapeWindows.h
|
||||
SettingsInterface.h
|
||||
SettingsWrapper.h
|
||||
StringUtil.h
|
||||
VectorIntrin.h
|
||||
WindowInfo.h
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2022 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <utility>
|
||||
|
||||
#include "MemorySettingsInterface.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
MemorySettingsInterface::MemorySettingsInterface() = default;
|
||||
|
||||
MemorySettingsInterface::~MemorySettingsInterface() = default;
|
||||
|
||||
bool MemorySettingsInterface::GetIntValue(const char* section, const char* key, s32* value) const
|
||||
{
|
||||
const auto sit = m_sections.find(section);
|
||||
if (sit == m_sections.end())
|
||||
return false;
|
||||
|
||||
const auto iter = sit->second.find(key);
|
||||
if (iter == sit->second.end())
|
||||
return false;
|
||||
|
||||
std::optional<s32> parsed = StringUtil::FromChars<s32>(iter->second, 10);
|
||||
if (!parsed.has_value())
|
||||
return false;
|
||||
|
||||
*value = parsed.value();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MemorySettingsInterface::GetUIntValue(const char* section, const char* key, u32* value) const
|
||||
{
|
||||
const auto sit = m_sections.find(section);
|
||||
if (sit == m_sections.end())
|
||||
return false;
|
||||
|
||||
const auto iter = sit->second.find(key);
|
||||
if (iter == sit->second.end())
|
||||
return false;
|
||||
|
||||
std::optional<u32> parsed = StringUtil::FromChars<u32>(iter->second, 10);
|
||||
if (!parsed.has_value())
|
||||
return false;
|
||||
|
||||
*value = parsed.value();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MemorySettingsInterface::GetFloatValue(const char* section, const char* key, float* value) const
|
||||
{
|
||||
const auto sit = m_sections.find(section);
|
||||
if (sit == m_sections.end())
|
||||
return false;
|
||||
|
||||
const auto iter = sit->second.find(key);
|
||||
if (iter == sit->second.end())
|
||||
return false;
|
||||
|
||||
std::optional<float> parsed = StringUtil::FromChars<float>(iter->second);
|
||||
if (!parsed.has_value())
|
||||
return false;
|
||||
|
||||
*value = parsed.value();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MemorySettingsInterface::GetDoubleValue(const char* section, const char* key, double* value) const
|
||||
{
|
||||
const auto sit = m_sections.find(section);
|
||||
if (sit == m_sections.end())
|
||||
return false;
|
||||
|
||||
const auto iter = sit->second.find(key);
|
||||
if (iter == sit->second.end())
|
||||
return false;
|
||||
|
||||
std::optional<double> parsed = StringUtil::FromChars<double>(iter->second);
|
||||
if (!parsed.has_value())
|
||||
return false;
|
||||
|
||||
*value = parsed.value();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MemorySettingsInterface::GetBoolValue(const char* section, const char* key, bool* value) const
|
||||
{
|
||||
const auto sit = m_sections.find(section);
|
||||
if (sit == m_sections.end())
|
||||
return false;
|
||||
|
||||
const auto iter = sit->second.find(key);
|
||||
if (iter == sit->second.end())
|
||||
return false;
|
||||
|
||||
std::optional<bool> parsed = StringUtil::FromChars<bool>(iter->second);
|
||||
if (!parsed.has_value())
|
||||
return false;
|
||||
|
||||
*value = parsed.value();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MemorySettingsInterface::GetStringValue(const char* section, const char* key, std::string* value) const
|
||||
{
|
||||
const auto sit = m_sections.find(section);
|
||||
if (sit == m_sections.end())
|
||||
return false;
|
||||
|
||||
const auto iter = sit->second.find(key);
|
||||
if (iter == sit->second.end())
|
||||
return false;
|
||||
|
||||
*value = iter->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MemorySettingsInterface::GetStringValueBuf(const char* section, const char* key,
|
||||
char* value, size_t value_size, size_t* out_len) const
|
||||
{
|
||||
std::string tmp;
|
||||
|
||||
if (value_size)
|
||||
value[0] = '\0';
|
||||
if (out_len)
|
||||
*out_len = 0;
|
||||
|
||||
if (!GetStringValue(section, key, &tmp))
|
||||
return false;
|
||||
|
||||
if (out_len)
|
||||
*out_len = tmp.size();
|
||||
if (value_size)
|
||||
strlcpy(value, tmp.c_str(), value_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MemorySettingsInterface::SetIntValue(const char* section, const char* key, s32 value)
|
||||
{
|
||||
SetValue(section, key, std::to_string(value));
|
||||
}
|
||||
|
||||
void MemorySettingsInterface::SetUIntValue(const char* section, const char* key, u32 value)
|
||||
{
|
||||
SetValue(section, key, std::to_string(value));
|
||||
}
|
||||
|
||||
void MemorySettingsInterface::SetFloatValue(const char* section, const char* key, float value)
|
||||
{
|
||||
SetValue(section, key, std::to_string(value));
|
||||
}
|
||||
|
||||
void MemorySettingsInterface::SetDoubleValue(const char* section, const char* key, double value)
|
||||
{
|
||||
SetValue(section, key, std::to_string(value));
|
||||
}
|
||||
|
||||
void MemorySettingsInterface::SetBoolValue(const char* section, const char* key, bool value)
|
||||
{
|
||||
SetValue(section, key, std::to_string(value));
|
||||
}
|
||||
|
||||
void MemorySettingsInterface::SetStringValue(const char* section, const char* key, const char* value)
|
||||
{
|
||||
SetValue(section, key, value);
|
||||
}
|
||||
|
||||
void MemorySettingsInterface::SetValue(const char* section, const char* key, std::string value)
|
||||
{
|
||||
auto sit = m_sections.find(section);
|
||||
if (sit == m_sections.end())
|
||||
sit = m_sections.emplace(std::make_pair(std::string(section), KeyMap())).first;
|
||||
|
||||
const auto range = sit->second.equal_range(key);
|
||||
if (range.first == sit->second.end())
|
||||
{
|
||||
sit->second.emplace(std::string(key), std::move(value));
|
||||
return;
|
||||
}
|
||||
|
||||
auto iter = range.first;
|
||||
iter->second = std::move(value);
|
||||
++iter;
|
||||
|
||||
// remove other values
|
||||
while (iter != range.second)
|
||||
{
|
||||
auto remove = iter++;
|
||||
sit->second.erase(remove);
|
||||
}
|
||||
}
|
||||
|
||||
void MemorySettingsInterface::DeleteValue(const char* section, const char* key)
|
||||
{
|
||||
auto sit = m_sections.find(section);
|
||||
if (sit == m_sections.end())
|
||||
return;
|
||||
|
||||
const auto range = sit->second.equal_range(key);
|
||||
for (auto iter = range.first; iter != range.second;)
|
||||
sit->second.erase(iter++);
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2022 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "SettingsInterface.h"
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
|
||||
class MemorySettingsInterface final : public SettingsInterface
|
||||
{
|
||||
public:
|
||||
MemorySettingsInterface();
|
||||
~MemorySettingsInterface();
|
||||
|
||||
bool GetIntValue(const char* section, const char* key, s32* value) const override;
|
||||
bool GetUIntValue(const char* section, const char* key, u32* value) const override;
|
||||
bool GetFloatValue(const char* section, const char* key, float* value) const override;
|
||||
bool GetDoubleValue(const char* section, const char* key, double* value) const override;
|
||||
bool GetBoolValue(const char* section, const char* key, bool* value) const override;
|
||||
bool GetStringValue(const char* section, const char* key, std::string* value) const override;
|
||||
bool GetStringValueBuf(const char* section, const char* key, char* value, size_t value_size, size_t* out_len = NULL) const override;
|
||||
|
||||
void SetIntValue(const char* section, const char* key, s32 value) override;
|
||||
void SetUIntValue(const char* section, const char* key, u32 value) override;
|
||||
void SetFloatValue(const char* section, const char* key, float value) override;
|
||||
void SetDoubleValue(const char* section, const char* key, double value) override;
|
||||
void SetBoolValue(const char* section, const char* key, bool value) override;
|
||||
void SetStringValue(const char* section, const char* key, const char* value) override;
|
||||
|
||||
void DeleteValue(const char* section, const char* key) override;
|
||||
|
||||
// default parameter overloads
|
||||
using SettingsInterface::GetBoolValue;
|
||||
using SettingsInterface::GetDoubleValue;
|
||||
using SettingsInterface::GetFloatValue;
|
||||
using SettingsInterface::GetIntValue;
|
||||
using SettingsInterface::GetStringValue;
|
||||
using SettingsInterface::GetUIntValue;
|
||||
|
||||
private:
|
||||
using KeyMap = std::unordered_multimap<std::string, std::string>;
|
||||
|
||||
void SetValue(const char* section, const char* key, std::string value);
|
||||
|
||||
std::unordered_map<std::string, KeyMap> m_sections;
|
||||
};
|
||||
@@ -1,155 +0,0 @@
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Pcsx2Defs.h"
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
class SettingsInterface
|
||||
{
|
||||
public:
|
||||
virtual ~SettingsInterface() = default;
|
||||
|
||||
virtual bool GetIntValue(const char* section, const char* key, int* value) const = 0;
|
||||
virtual bool GetUIntValue(const char* section, const char* key, uint* value) const = 0;
|
||||
virtual bool GetFloatValue(const char* section, const char* key, float* value) const = 0;
|
||||
virtual bool GetDoubleValue(const char* section, const char* key, double* value) const = 0;
|
||||
virtual bool GetBoolValue(const char* section, const char* key, bool* value) const = 0;
|
||||
virtual bool GetStringValue(const char* section, const char* key, std::string* value) const = 0;
|
||||
|
||||
/* Buffer form, for callers that hold a fixed-size field rather than a
|
||||
* string. Returns false and leaves the buffer empty when the key is
|
||||
* absent, so a missing key stays distinguishable from an empty value.
|
||||
* A value longer than the buffer is truncated, and the caller is told
|
||||
* by out_len, which reports the length the value actually had. */
|
||||
virtual bool GetStringValueBuf(const char* section, const char* key,
|
||||
char* value, size_t value_size, size_t* out_len = NULL) const = 0;
|
||||
|
||||
virtual void SetIntValue(const char* section, const char* key, int value) = 0;
|
||||
virtual void SetUIntValue(const char* section, const char* key, uint value) = 0;
|
||||
virtual void SetFloatValue(const char* section, const char* key, float value) = 0;
|
||||
virtual void SetDoubleValue(const char* section, const char* key, double value) = 0;
|
||||
virtual void SetBoolValue(const char* section, const char* key, bool value) = 0;
|
||||
virtual void SetStringValue(const char* section, const char* key, const char* value) = 0;
|
||||
|
||||
virtual void DeleteValue(const char* section, const char* key) = 0;
|
||||
|
||||
__fi int GetIntValue(const char* section, const char* key, int default_value = 0) const
|
||||
{
|
||||
int value;
|
||||
return GetIntValue(section, key, &value) ? value : default_value;
|
||||
}
|
||||
|
||||
__fi uint GetUIntValue(const char* section, const char* key, uint default_value = 0) const
|
||||
{
|
||||
uint value;
|
||||
return GetUIntValue(section, key, &value) ? value : default_value;
|
||||
}
|
||||
|
||||
__fi float GetFloatValue(const char* section, const char* key, float default_value = 0.0f) const
|
||||
{
|
||||
float value;
|
||||
return GetFloatValue(section, key, &value) ? value : default_value;
|
||||
}
|
||||
|
||||
__fi float GetDoubleValue(const char* section, const char* key, double default_value = 0.0) const
|
||||
{
|
||||
double value;
|
||||
return GetDoubleValue(section, key, &value) ? value : default_value;
|
||||
}
|
||||
|
||||
__fi bool GetBoolValue(const char* section, const char* key, bool default_value = false) const
|
||||
{
|
||||
bool value;
|
||||
return GetBoolValue(section, key, &value) ? value : default_value;
|
||||
}
|
||||
|
||||
__fi std::string GetStringValue(const char* section, const char* key, const char* default_value = "") const
|
||||
{
|
||||
std::string value;
|
||||
if (!GetStringValue(section, key, &value))
|
||||
value.assign(default_value);
|
||||
return value;
|
||||
}
|
||||
|
||||
__fi std::optional<int> GetOptionalIntValue(const char* section, const char* key, std::optional<int> default_value = std::nullopt)
|
||||
{
|
||||
int ret;
|
||||
return GetIntValue(section, key, &ret) ? std::optional<int>(ret) : default_value;
|
||||
}
|
||||
|
||||
__fi std::optional<uint> GetOptionalUIntValue(const char* section, const char* key, std::optional<uint> default_value = std::nullopt)
|
||||
{
|
||||
uint ret;
|
||||
return GetUIntValue(section, key, &ret) ? std::optional<uint>(ret) : default_value;
|
||||
}
|
||||
|
||||
__fi std::optional<float> GetOptionalFloatValue(const char* section, const char* key, std::optional<float> default_value = std::nullopt)
|
||||
{
|
||||
float ret;
|
||||
return GetFloatValue(section, key, &ret) ? std::optional<float>(ret) : default_value;
|
||||
}
|
||||
|
||||
__fi std::optional<double> GetOptionalDoubleValue(const char* section, const char* key, std::optional<double> default_value = std::nullopt)
|
||||
{
|
||||
double ret;
|
||||
return GetDoubleValue(section, key, &ret) ? std::optional<double>(ret) : default_value;
|
||||
}
|
||||
|
||||
__fi std::optional<bool> GetOptionalBoolValue(const char* section, const char* key, std::optional<bool> default_value = std::nullopt)
|
||||
{
|
||||
bool ret;
|
||||
return GetBoolValue(section, key, &ret) ? std::optional<bool>(ret) : default_value;
|
||||
}
|
||||
|
||||
__fi std::optional<std::string> GetOptionalStringValue(const char* section, const char* key, std::optional<const char*> default_value = std::nullopt) const
|
||||
{
|
||||
std::string ret;
|
||||
return GetStringValue(section, key, &ret) ? std::optional<std::string>(ret) : default_value;
|
||||
}
|
||||
|
||||
__fi void SetOptionalIntValue(const char* section, const char* key, const std::optional<int>& value)
|
||||
{
|
||||
value.has_value() ? SetIntValue(section, key, value.value()) : DeleteValue(section, key);
|
||||
}
|
||||
|
||||
__fi void SetOptionalUIntValue(const char* section, const char* key, const std::optional<uint>& value)
|
||||
{
|
||||
value.has_value() ? SetUIntValue(section, key, value.value()) : DeleteValue(section, key);
|
||||
}
|
||||
|
||||
__fi void SetOptionalFloatValue(const char* section, const char* key, const std::optional<float>& value)
|
||||
{
|
||||
value.has_value() ? SetFloatValue(section, key, value.value()) : DeleteValue(section, key);
|
||||
}
|
||||
|
||||
__fi void SetOptionalDoubleValue(const char* section, const char* key, const std::optional<double>& value)
|
||||
{
|
||||
value.has_value() ? SetDoubleValue(section, key, value.value()) : DeleteValue(section, key);
|
||||
}
|
||||
|
||||
__fi void SetOptionalBoolValue(const char* section, const char* key, const std::optional<bool>& value)
|
||||
{
|
||||
value.has_value() ? SetBoolValue(section, key, value.value()) : DeleteValue(section, key);
|
||||
}
|
||||
|
||||
__fi void SetOptionalStringValue(const char* section, const char* key, const std::optional<const char*>& value)
|
||||
{
|
||||
value.has_value() ? SetStringValue(section, key, value.value()) : DeleteValue(section, key);
|
||||
}
|
||||
};
|
||||
@@ -1,183 +0,0 @@
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "SettingsWrapper.h"
|
||||
#include "Console.h"
|
||||
|
||||
static int _calcEnumLength(const char* const* enumArray)
|
||||
{
|
||||
int cnt = 0;
|
||||
while (*enumArray != nullptr)
|
||||
{
|
||||
enumArray++;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
SettingsWrapper::SettingsWrapper(SettingsInterface& si)
|
||||
: m_si(si)
|
||||
{
|
||||
}
|
||||
|
||||
SettingsLoadWrapper::SettingsLoadWrapper(SettingsInterface& si)
|
||||
: SettingsWrapper(si)
|
||||
{
|
||||
}
|
||||
|
||||
bool SettingsLoadWrapper::IsLoading() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SettingsLoadWrapper::IsSaving() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void SettingsLoadWrapper::Entry(const char* section, const char* var, int& value, const int defvalue /*= 0*/)
|
||||
{
|
||||
value = m_si.GetIntValue(section, var, defvalue);
|
||||
}
|
||||
|
||||
void SettingsLoadWrapper::Entry(const char* section, const char* var, uint& value, const uint defvalue /*= 0*/)
|
||||
{
|
||||
value = m_si.GetUIntValue(section, var, defvalue);
|
||||
}
|
||||
|
||||
void SettingsLoadWrapper::Entry(const char* section, const char* var, bool& value, const bool defvalue /*= false*/)
|
||||
{
|
||||
value = m_si.GetBoolValue(section, var, defvalue);
|
||||
}
|
||||
|
||||
void SettingsLoadWrapper::Entry(const char* section, const char* var, float& value, const float defvalue /*= 0.0*/)
|
||||
{
|
||||
value = m_si.GetFloatValue(section, var, defvalue);
|
||||
}
|
||||
|
||||
void SettingsLoadWrapper::Entry(const char* section, const char* var, std::string& value, const std::string& default_value /*= std::string()*/)
|
||||
{
|
||||
if (!m_si.GetStringValue(section, var, &value) && &value != &default_value)
|
||||
value = default_value;
|
||||
}
|
||||
|
||||
void SettingsLoadWrapper::EntryBuf(const char* section, const char* var, char* value, size_t value_size, const char* default_value)
|
||||
{
|
||||
if (!m_si.GetStringValueBuf(section, var, value, value_size))
|
||||
strlcpy(value, default_value, value_size);
|
||||
}
|
||||
|
||||
void SettingsLoadWrapper::_EnumEntry(const char* section, const char* var, int& value, const char* const* enumArray, int defvalue)
|
||||
{
|
||||
const int cnt = _calcEnumLength(enumArray);
|
||||
defvalue = std::min(std::max(defvalue, 0), cnt);
|
||||
|
||||
const std::string retval(m_si.GetStringValue(section, var, enumArray[defvalue]));
|
||||
|
||||
int i = 0;
|
||||
while (enumArray[i] != nullptr && (retval != enumArray[i]))
|
||||
i++;
|
||||
|
||||
if (enumArray[i] == nullptr)
|
||||
{
|
||||
Console.Warning("(LoadSettings) Warning: Unrecognized value '%s' on key '%s'\n\tUsing the default setting of '%s'.",
|
||||
retval.c_str(), var, enumArray[defvalue]);
|
||||
value = defvalue;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = i;
|
||||
}
|
||||
}
|
||||
|
||||
bool SettingsLoadWrapper::EntryBitBool(const char* section, const char* var, bool value, const bool defvalue /*= false*/)
|
||||
{
|
||||
return m_si.GetBoolValue(section, var, defvalue);
|
||||
}
|
||||
|
||||
int SettingsLoadWrapper::EntryBitfield(const char* section, const char* var, int value, const int defvalue /*= 0*/)
|
||||
{
|
||||
return m_si.GetIntValue(section, var, defvalue);
|
||||
}
|
||||
|
||||
SettingsSaveWrapper::SettingsSaveWrapper(SettingsInterface& si)
|
||||
: SettingsWrapper(si)
|
||||
{
|
||||
}
|
||||
|
||||
bool SettingsSaveWrapper::IsLoading() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SettingsSaveWrapper::IsSaving() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void SettingsSaveWrapper::Entry(const char* section, const char* var, int& value, const int defvalue /*= 0*/)
|
||||
{
|
||||
m_si.SetIntValue(section, var, value);
|
||||
}
|
||||
|
||||
void SettingsSaveWrapper::Entry(const char* section, const char* var, uint& value, const uint defvalue /*= 0*/)
|
||||
{
|
||||
m_si.SetUIntValue(section, var, value);
|
||||
}
|
||||
|
||||
void SettingsSaveWrapper::Entry(const char* section, const char* var, bool& value, const bool defvalue /*= false*/)
|
||||
{
|
||||
m_si.SetBoolValue(section, var, value);
|
||||
}
|
||||
|
||||
void SettingsSaveWrapper::Entry(const char* section, const char* var, float& value, const float defvalue /*= 0.0*/)
|
||||
{
|
||||
m_si.SetFloatValue(section, var, value);
|
||||
}
|
||||
|
||||
void SettingsSaveWrapper::Entry(const char* section, const char* var, std::string& value, const std::string& default_value /*= std::string()*/)
|
||||
{
|
||||
m_si.SetStringValue(section, var, value.c_str());
|
||||
}
|
||||
|
||||
void SettingsSaveWrapper::EntryBuf(const char* section, const char* var, char* value, size_t value_size, const char* default_value)
|
||||
{
|
||||
(void)value_size;
|
||||
(void)default_value;
|
||||
m_si.SetStringValue(section, var, value);
|
||||
}
|
||||
|
||||
bool SettingsSaveWrapper::EntryBitBool(const char* section, const char* var, bool value, const bool defvalue /*= false*/)
|
||||
{
|
||||
m_si.SetBoolValue(section, var, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
int SettingsSaveWrapper::EntryBitfield(const char* section, const char* var, int value, const int defvalue /*= 0*/)
|
||||
{
|
||||
m_si.SetIntValue(section, var, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
void SettingsSaveWrapper::_EnumEntry(const char* section, const char* var, int& value, const char* const* enumArray, int defvalue)
|
||||
{
|
||||
const int cnt = _calcEnumLength(enumArray);
|
||||
const int index = (value < 0 || value >= cnt) ? defvalue : value;
|
||||
m_si.SetStringValue(section, var, enumArray[index]);
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SettingsInterface.h"
|
||||
|
||||
// Helper class which loads or saves depending on the derived class.
|
||||
class SettingsWrapper
|
||||
{
|
||||
public:
|
||||
SettingsWrapper(SettingsInterface& si);
|
||||
|
||||
virtual bool IsLoading() const = 0;
|
||||
virtual bool IsSaving() const = 0;
|
||||
|
||||
virtual void Entry(const char* section, const char* var, int& value, const int defvalue = 0) = 0;
|
||||
virtual void Entry(const char* section, const char* var, uint& value, const uint defvalue = 0) = 0;
|
||||
virtual void Entry(const char* section, const char* var, bool& value, const bool defvalue = false) = 0;
|
||||
virtual void Entry(const char* section, const char* var, float& value, const float defvalue = 0.0) = 0;
|
||||
virtual void Entry(const char* section, const char* var, std::string& value, const std::string& default_value = std::string()) = 0;
|
||||
|
||||
/* Buffer form: the value lands in a caller-owned array. */
|
||||
virtual void EntryBuf(const char* section, const char* var, char* value, size_t value_size, const char* default_value = "") = 0;
|
||||
|
||||
// This special form of Entry is provided for bitfields, which cannot be passed by reference.
|
||||
virtual bool EntryBitBool(const char* section, const char* var, bool value, const bool defvalue = false) = 0;
|
||||
virtual int EntryBitfield(const char* section, const char* var, int value, const int defvalue = 0) = 0;
|
||||
|
||||
template <typename T>
|
||||
void EnumEntry(const char* section, const char* var, T& value, const char* const* enumArray = nullptr, const T defvalue = (T)0)
|
||||
{
|
||||
int tstore = (int)value;
|
||||
auto defaultvalue = enum_cast(defvalue);
|
||||
if (enumArray == NULL)
|
||||
Entry(section, var, tstore, defaultvalue);
|
||||
else
|
||||
_EnumEntry(section, var, tstore, enumArray, defaultvalue);
|
||||
value = (T)tstore;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void _EnumEntry(const char* section, const char* var, int& value, const char* const* enumArray, int defvalue) = 0;
|
||||
|
||||
SettingsInterface& m_si;
|
||||
};
|
||||
|
||||
class SettingsLoadWrapper final : public SettingsWrapper
|
||||
{
|
||||
public:
|
||||
SettingsLoadWrapper(SettingsInterface& si);
|
||||
|
||||
bool IsLoading() const override;
|
||||
bool IsSaving() const override;
|
||||
|
||||
void Entry(const char* section, const char* var, int& value, const int defvalue = 0) override;
|
||||
void EntryBuf(const char* section, const char* var, char* value, size_t value_size, const char* default_value = "") override;
|
||||
void Entry(const char* section, const char* var, uint& value, const uint defvalue = 0) override;
|
||||
void Entry(const char* section, const char* var, bool& value, const bool defvalue = false) override;
|
||||
void Entry(const char* section, const char* var, float& value, const float defvalue = 0.0) override;
|
||||
|
||||
void Entry(const char* section, const char* var, std::string& value, const std::string& default_value = std::string()) override;
|
||||
bool EntryBitBool(const char* section, const char* var, bool value, const bool defvalue = false) override;
|
||||
int EntryBitfield(const char* section, const char* var, int value, const int defvalue = 0) override;
|
||||
|
||||
protected:
|
||||
void _EnumEntry(const char* section, const char* var, int& value, const char* const* enumArray, int defvalue) override;
|
||||
};
|
||||
|
||||
class SettingsSaveWrapper final : public SettingsWrapper
|
||||
{
|
||||
public:
|
||||
SettingsSaveWrapper(SettingsInterface& si);
|
||||
|
||||
bool IsLoading() const override;
|
||||
bool IsSaving() const override;
|
||||
|
||||
void EntryBuf(const char* section, const char* var, char* value, size_t value_size, const char* default_value = "") override;
|
||||
void Entry(const char* section, const char* var, int& value, const int defvalue = 0) override;
|
||||
void Entry(const char* section, const char* var, uint& value, const uint defvalue = 0) override;
|
||||
void Entry(const char* section, const char* var, bool& value, const bool defvalue = false) override;
|
||||
void Entry(const char* section, const char* var, float& value, const float defvalue = 0.0) override;
|
||||
|
||||
void Entry(const char* section, const char* var, std::string& value, const std::string& default_value = std::string()) override;
|
||||
bool EntryBitBool(const char* section, const char* var, bool value, const bool defvalue = false) override;
|
||||
int EntryBitfield(const char* section, const char* var, int value, const int defvalue = 0) override;
|
||||
|
||||
protected:
|
||||
void _EnumEntry(const char* section, const char* var, int& value, const char* const* enumArray, int defvalue) override;
|
||||
};
|
||||
|
||||
#define SettingsWrapSection(section) const char* CURRENT_SETTINGS_SECTION = section;
|
||||
#define SettingsWrapEntry(var) wrap.Entry(CURRENT_SETTINGS_SECTION, #var, var, var)
|
||||
/* Buffer form, for fields that are char arrays rather than std::string. */
|
||||
#define SettingsWrapEntryBuf(var) wrap.EntryBuf(CURRENT_SETTINGS_SECTION, #var, var, sizeof(var), var)
|
||||
#define SettingsWrapEntryEx(var, name) wrap.Entry(CURRENT_SETTINGS_SECTION, name, var, var)
|
||||
#define SettingsWrapBitfield(varname) varname = wrap.EntryBitfield(CURRENT_SETTINGS_SECTION, #varname, varname, varname)
|
||||
#define SettingsWrapBitBool(varname) varname = wrap.EntryBitBool(CURRENT_SETTINGS_SECTION, #varname, !!varname, varname)
|
||||
#define SettingsWrapBitfieldEx(varname, textname) varname = wrap.EntryBitfield(CURRENT_SETTINGS_SECTION, textname, varname, varname)
|
||||
#define SettingsWrapBitBoolEx(varname, textname) varname = wrap.EntryBitBool(CURRENT_SETTINGS_SECTION, textname, !!varname, varname)
|
||||
#define SettingsWrapEnumEx(varname, textname, names) wrap.EnumEntry(CURRENT_SETTINGS_SECTION, textname, varname, names, varname)
|
||||
#define SettingsWrapIntEnumEx(varname, textname) varname = static_cast<decltype(varname)>(wrap.EntryBitfield(CURRENT_SETTINGS_SECTION, textname, static_cast<int>(varname), static_cast<int>(varname)))
|
||||
|
||||
+87
-83
@@ -30,7 +30,6 @@
|
||||
#include "../pcsx2/Host.h"
|
||||
|
||||
#include "HostFS.h"
|
||||
#include "../common/MemorySettingsInterface.h"
|
||||
|
||||
#include "../pcsx2/GS/Renderers/Common/GSRenderer.h"
|
||||
#ifdef ENABLE_VULKAN
|
||||
@@ -43,7 +42,6 @@
|
||||
#include <libretro_vulkan.h>
|
||||
#endif
|
||||
#include "../pcsx2/Frontend/InputManager.h"
|
||||
#include "../pcsx2/Frontend/LayeredSettingsInterface.h"
|
||||
#include "../pcsx2/VMManager.h"
|
||||
#include "../pcsx2/Patch.h"
|
||||
|
||||
@@ -62,7 +60,18 @@ retro_log_printf_t log_cb;
|
||||
static retro_audio_sample_batch_t batch_cb;
|
||||
struct retro_hw_render_callback hw_render;
|
||||
|
||||
MemorySettingsInterface s_settings_interface;
|
||||
/* The core options, as the config they set: the fields directly, with
|
||||
* Pcsx2Config's own defaults for whatever no option touches, and the
|
||||
* hardware-dependent defaults applied before the options. Three values
|
||||
* no Pcsx2Config field holds ride beside it. VMManager copies this at
|
||||
* every LoadSettings, then diffs old against new as it always did. */
|
||||
static Pcsx2Config s_option_config;
|
||||
static char s_option_bios[PCSX2_PATH_MAX];
|
||||
static bool s_option_fast_boot = true;
|
||||
static char s_option_memcards[PCSX2_PATH_MAX];
|
||||
const Pcsx2Config& Host::OptionConfig() { return s_option_config; }
|
||||
const char* Host::OptionBiosPath() { return s_option_bios; }
|
||||
bool Host::OptionFastBoot() { return s_option_fast_boot; }
|
||||
|
||||
bool pending_update_av_info = false;
|
||||
std::string libretro_content;
|
||||
@@ -467,21 +476,21 @@ static void check_variables(bool first_run)
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
setting_bios = var.value;
|
||||
s_settings_interface.SetStringValue("Filenames", "BIOS", setting_bios.c_str());
|
||||
strlcpy(s_option_bios, setting_bios.c_str(), sizeof(s_option_bios));
|
||||
}
|
||||
|
||||
var.key = "pcsx2_fastboot";
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
bool fast_boot = !strcmp(var.value, "enabled");
|
||||
s_settings_interface.SetBoolValue("EmuCore", "EnableFastBoot", fast_boot);
|
||||
s_option_fast_boot = fast_boot;
|
||||
}
|
||||
|
||||
var.key = "pcsx2_fastcdvd";
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
bool fast_cdvd = !strcmp(var.value, "enabled");
|
||||
s_settings_interface.SetBoolValue("EmuCore/Speedhacks", "fastCDVD", fast_cdvd);
|
||||
s_option_config.Speedhacks.fastCDVD = fast_cdvd;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,7 +517,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_pgs_super_sampling != pgs_super_sampling_prev)
|
||||
{
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "pgsSuperSampling", setting_pgs_super_sampling);
|
||||
s_option_config.GS.PGSSuperSampling = static_cast<decltype(s_option_config.GS.PGSSuperSampling)>(setting_pgs_super_sampling);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -521,7 +530,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_pgs_ss_tex != pgs_ss_tex_prev)
|
||||
{
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "pgsSuperSampleTextures", setting_pgs_ss_tex);
|
||||
s_option_config.GS.PGSSuperSampleTextures = static_cast<decltype(s_option_config.GS.PGSSuperSampleTextures)>(setting_pgs_ss_tex);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -534,7 +543,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_pgs_deblur != pgs_deblur_prev)
|
||||
{
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "pgsSharpBackbuffer", setting_pgs_deblur);
|
||||
s_option_config.GS.PGSSharpBackbuffer = static_cast<decltype(s_option_config.GS.PGSSharpBackbuffer)>(setting_pgs_deblur);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -552,11 +561,11 @@ static void check_variables(bool first_run)
|
||||
setting_pgs_high_res_scanout = !strcmp(var.value, "enabled");
|
||||
|
||||
if (first_run)
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "pgsHighResScanout", setting_pgs_high_res_scanout);
|
||||
s_option_config.GS.PGSHighResScanout = static_cast<decltype(s_option_config.GS.PGSHighResScanout)>(setting_pgs_high_res_scanout);
|
||||
else if (setting_pgs_high_res_scanout != pgs_high_res_scanout_prev)
|
||||
{
|
||||
retro_system_av_info av_info;
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "pgsHighResScanout", setting_pgs_high_res_scanout);
|
||||
s_option_config.GS.PGSHighResScanout = static_cast<decltype(s_option_config.GS.PGSHighResScanout)>(setting_pgs_high_res_scanout);
|
||||
|
||||
retro_get_system_av_info(&av_info);
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &av_info);
|
||||
@@ -576,9 +585,9 @@ static void check_variables(bool first_run)
|
||||
if (first_run || setting_pgs_disable_mipmaps != pgs_disable_mipmaps_prev)
|
||||
{
|
||||
const u8 mipmap_mode = (u8)(setting_pgs_disable_mipmaps ? GSHWMipmapMode::Unclamped : GSHWMipmapMode::Enabled);
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "hw_mipmap_mode", mipmap_mode);
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "mipmap", !setting_pgs_disable_mipmaps);
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "pgsDisableMipmaps", setting_pgs_disable_mipmaps);
|
||||
s_option_config.GS.HWMipmapMode = static_cast<decltype(s_option_config.GS.HWMipmapMode)>(mipmap_mode);
|
||||
s_option_config.GS.Mipmap = !setting_pgs_disable_mipmaps;
|
||||
s_option_config.GS.PGSDisableMipmaps = static_cast<decltype(s_option_config.GS.PGSDisableMipmaps)>(setting_pgs_disable_mipmaps);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -601,7 +610,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_pcrtc_antiblur != pcrtc_antiblur_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "pcrtc_antiblur", setting_pcrtc_antiblur);
|
||||
s_option_config.GS.PCRTCAntiBlur = setting_pcrtc_antiblur;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -614,7 +623,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_pcrtc_screen_offsets != pcrtc_screen_offsets_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "pcrtc_offsets", setting_pcrtc_screen_offsets);
|
||||
s_option_config.GS.PCRTCOffsets = setting_pcrtc_screen_offsets;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -627,7 +636,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_disable_interlace_offset != disable_interlace_offset_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "disable_interlace_offset", setting_disable_interlace_offset);
|
||||
s_option_config.GS.DisableInterlaceOffset = setting_disable_interlace_offset;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -659,7 +668,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_deinterlace_mode != deinterlace_mode_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "deinterlace_mode", setting_deinterlace_mode);
|
||||
s_option_config.GS.InterlaceMode = static_cast<decltype(s_option_config.GS.InterlaceMode)>(setting_deinterlace_mode);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -679,7 +688,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_hw_download_mode != hw_download_mode_prev)
|
||||
{
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "HWDownloadMode", setting_hw_download_mode);
|
||||
s_option_config.GS.HWDownloadMode = static_cast<decltype(s_option_config.GS.HWDownloadMode)>(setting_hw_download_mode);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -699,7 +708,7 @@ static void check_variables(bool first_run)
|
||||
setting_upscale_multiplier = atoi(var.value);
|
||||
|
||||
if (first_run)
|
||||
s_settings_interface.SetFloatValue("EmuCore/GS", "upscale_multiplier", setting_upscale_multiplier);
|
||||
s_option_config.GS.UpscaleMultiplier = setting_upscale_multiplier;
|
||||
#if 0
|
||||
// TODO: ATM it crashes when changed on-the-fly, re-enable when fixed
|
||||
// also remove "(Restart)" from the core option label
|
||||
@@ -710,7 +719,7 @@ static void check_variables(bool first_run)
|
||||
else if (setting_upscale_multiplier != upscale_multiplier_prev)
|
||||
{
|
||||
retro_system_av_info av_info;
|
||||
s_settings_interface.SetFloatValue("EmuCore/GS", "upscale_multiplier", setting_upscale_multiplier);
|
||||
s_option_config.GS.UpscaleMultiplier = setting_upscale_multiplier;
|
||||
|
||||
retro_get_system_av_info(&av_info);
|
||||
#if 1
|
||||
@@ -738,7 +747,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_trilinear_filtering != trilinear_filtering_prev)
|
||||
{
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "TriFilter", setting_trilinear_filtering);
|
||||
s_option_config.GS.TriFilter = static_cast<decltype(s_option_config.GS.TriFilter)>(setting_trilinear_filtering);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -751,7 +760,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_anisotropic_filtering != anisotropic_filtering_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "MaxAnisotropy", setting_anisotropic_filtering);
|
||||
s_option_config.GS.MaxAnisotropy = setting_anisotropic_filtering;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -771,7 +780,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_dithering != dithering_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "dithering_ps2", setting_dithering);
|
||||
s_option_config.GS.Dithering = setting_dithering;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -795,7 +804,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_blending_accuracy != blending_accuracy_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "accurate_blending_unit", setting_blending_accuracy);
|
||||
s_option_config.GS.AccurateBlendingUnit = static_cast<decltype(s_option_config.GS.AccurateBlendingUnit)>(setting_blending_accuracy);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -808,7 +817,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_enable_hw_hacks != enable_hw_hacks_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "UserHacks", setting_enable_hw_hacks);
|
||||
s_option_config.GS.ManualUserHacks = setting_enable_hw_hacks;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -823,7 +832,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_cpu_sprite_size != cpu_sprite_size_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "UserHacks_CPUSpriteRenderBW", setting_cpu_sprite_size);
|
||||
s_option_config.GS.UserHacks_CPUSpriteRenderBW = setting_cpu_sprite_size;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -841,7 +850,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_cpu_sprite_level != cpu_sprite_level_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "UserHacks_CPUSpriteRenderLevel", setting_cpu_sprite_level);
|
||||
s_option_config.GS.UserHacks_CPUSpriteRenderLevel = setting_cpu_sprite_level;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -859,7 +868,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_software_clut_render != software_clut_render_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "UserHacks_CPUCLUTRender", setting_software_clut_render);
|
||||
s_option_config.GS.UserHacks_CPUCLUTRender = setting_software_clut_render;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -877,7 +886,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_gpu_target_clut != gpu_target_clut_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "UserHacks_GPUTargetCLUTMode", setting_gpu_target_clut);
|
||||
s_option_config.GS.UserHacks_GPUTargetCLUTMode = static_cast<decltype(s_option_config.GS.UserHacks_GPUTargetCLUTMode)>(setting_gpu_target_clut);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -895,7 +904,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_auto_flush != auto_flush_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "UserHacks_AutoFlushLevel", setting_auto_flush);
|
||||
s_option_config.GS.UserHacks_AutoFlush = static_cast<decltype(s_option_config.GS.UserHacks_AutoFlush)>(setting_auto_flush);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -913,7 +922,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_texture_inside_rt != texture_inside_rt_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "UserHacks_TextureInsideRt", setting_texture_inside_rt);
|
||||
s_option_config.GS.UserHacks_TextureInsideRt = static_cast<decltype(s_option_config.GS.UserHacks_TextureInsideRt)>(setting_texture_inside_rt);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -926,7 +935,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_disable_depth_conversion != disable_depth_conversion_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "UserHacks_DisableDepthSupport", setting_disable_depth_conversion);
|
||||
s_option_config.GS.UserHacks_DisableDepthSupport = setting_disable_depth_conversion;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -943,7 +952,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_framebuffer_conversion != framebuffer_conversion_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "UserHacks_CPU_FB_Conversion", setting_framebuffer_conversion);
|
||||
s_option_config.GS.UserHacks_CPUFBConversion = setting_framebuffer_conversion;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -956,7 +965,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_disable_partial_invalid != disable_partial_invalid_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "UserHacks_DisablePartialInvalidation", setting_disable_partial_invalid);
|
||||
s_option_config.GS.UserHacks_DisablePartialInvalidation = setting_disable_partial_invalid;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -969,7 +978,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_gpu_palette_conversion != gpu_palette_conversion_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "paltex", setting_gpu_palette_conversion);
|
||||
s_option_config.GS.GPUPaletteConversion = setting_gpu_palette_conversion;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -982,7 +991,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_preload_frame_data != preload_frame_data_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "preload_frame_with_gs_data", setting_preload_frame_data);
|
||||
s_option_config.GS.PreloadFrameWithGSData = setting_preload_frame_data;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1004,7 +1013,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_half_pixel_offset != half_pixel_offset_prev)
|
||||
{
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "UserHacks_HalfPixelOffset", setting_half_pixel_offset);
|
||||
s_option_config.GS.UserHacks_HalfPixelOffset = static_cast<decltype(s_option_config.GS.UserHacks_HalfPixelOffset)>(setting_half_pixel_offset);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1022,7 +1031,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_native_scaling != native_scaling_prev)
|
||||
{
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "UserHacks_native_scaling", setting_native_scaling);
|
||||
s_option_config.GS.UserHacks_NativeScaling = static_cast<decltype(s_option_config.GS.UserHacks_NativeScaling)>(setting_native_scaling);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1040,7 +1049,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_round_sprite != round_sprite_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "UserHacks_round_sprite_offset", setting_round_sprite);
|
||||
s_option_config.GS.UserHacks_RoundSprite = setting_round_sprite;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1053,7 +1062,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_align_sprite != align_sprite_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "UserHacks_align_sprite_X", setting_align_sprite);
|
||||
s_option_config.GS.UserHacks_AlignSpriteX = setting_align_sprite;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1066,7 +1075,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_merge_sprite != merge_sprite_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "UserHacks_merge_pp_sprite", setting_merge_sprite);
|
||||
s_option_config.GS.UserHacks_MergePPSprite = setting_merge_sprite;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1079,7 +1088,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_unscaled_palette_draw != unscaled_palette_draw_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "UserHacks_NativePaletteDraw", setting_unscaled_palette_draw);
|
||||
s_option_config.GS.UserHacks_NativePaletteDraw = setting_unscaled_palette_draw;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1092,7 +1101,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_force_sprite_position != force_sprite_position_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "UserHacks_ForceEvenSpritePosition", setting_force_sprite_position);
|
||||
s_option_config.GS.UserHacks_ForceEvenSpritePosition = setting_force_sprite_position;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1109,7 +1118,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_auto_flush_software != auto_flush_software_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/GS", "autoflush_sw", setting_auto_flush_software);
|
||||
s_option_config.GS.AutoFlushSW = setting_auto_flush_software;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1132,7 +1141,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_texture_filtering != texture_filtering_prev)
|
||||
{
|
||||
s_settings_interface.SetUIntValue("EmuCore/GS", "filter", setting_texture_filtering);
|
||||
s_option_config.GS.TextureFiltering = static_cast<decltype(s_option_config.GS.TextureFiltering)>(setting_texture_filtering);
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1155,7 +1164,7 @@ static void check_variables(bool first_run)
|
||||
else if (!strcmp(var.value, "120 GiB"))
|
||||
gib = 120;
|
||||
setting_dev9_hdd_sectors = gib * (1024 * 1024 * 1024 / 512);
|
||||
s_settings_interface.SetUIntValue("DEV9/Hdd", "HddSizeSectors", setting_dev9_hdd_sectors);
|
||||
s_option_config.DEV9.HddSizeSectors = setting_dev9_hdd_sectors;
|
||||
}
|
||||
|
||||
var.key = "pcsx2_dev9_hdd";
|
||||
@@ -1168,7 +1177,7 @@ static void check_variables(bool first_run)
|
||||
{
|
||||
if (setting_dev9_hdd)
|
||||
dev9_ensure_hdd_image(setting_dev9_hdd_sectors);
|
||||
s_settings_interface.SetBoolValue("DEV9/Hdd", "HddEnable", setting_dev9_hdd);
|
||||
s_option_config.DEV9.HddEnable = setting_dev9_hdd;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1181,11 +1190,11 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_dev9_eth != dev9_eth_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("DEV9/Eth", "EthEnable", setting_dev9_eth);
|
||||
s_option_config.DEV9.EthEnable = setting_dev9_eth;
|
||||
if (setting_dev9_eth)
|
||||
{
|
||||
s_settings_interface.SetStringValue("DEV9/Eth", "EthApi", "Sockets");
|
||||
s_settings_interface.SetStringValue("DEV9/Eth", "EthDevice", "Auto");
|
||||
s_option_config.DEV9.EthApi = Pcsx2Config::DEV9Options::NetApi::Sockets;
|
||||
s_option_config.DEV9.EthDevice = "Auto";
|
||||
}
|
||||
updated = true;
|
||||
}
|
||||
@@ -1199,7 +1208,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_enable_cheats != enable_cheats_prev)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore", "EnableCheats", setting_enable_cheats);
|
||||
s_option_config.EnableCheats = setting_enable_cheats;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1228,7 +1237,7 @@ static void check_variables(bool first_run)
|
||||
setting_vu_accurate_addsub = vu_addsub;
|
||||
updated = true;
|
||||
}
|
||||
s_settings_interface.SetBoolValue("EmuCore/CPU/Recompiler", "EnableVuAccurateAddSub", vu_addsub);
|
||||
s_option_config.Cpu.Recompiler.EnableVuAccurateAddSub = vu_addsub;
|
||||
}
|
||||
|
||||
var.key = "pcsx2_ee_accurate_fpu";
|
||||
@@ -1240,7 +1249,7 @@ static void check_variables(bool first_run)
|
||||
setting_ee_accurate_fpu = ee_acc;
|
||||
updated = true;
|
||||
}
|
||||
s_settings_interface.SetBoolValue("EmuCore/CPU/Recompiler", "EnableFpuAccurateArith", ee_acc);
|
||||
s_option_config.Cpu.Recompiler.EnableFpuAccurateArith = ee_acc;
|
||||
}
|
||||
|
||||
var.key = "pcsx2_vu_exact_mul";
|
||||
@@ -1252,7 +1261,7 @@ static void check_variables(bool first_run)
|
||||
setting_vu_exact_mul = vu_exact;
|
||||
updated = true;
|
||||
}
|
||||
s_settings_interface.SetBoolValue("EmuCore/CPU/Recompiler", "EnableVuExactMul", vu_exact);
|
||||
s_option_config.Cpu.Recompiler.EnableVuExactMul = vu_exact;
|
||||
}
|
||||
|
||||
var.key = "pcsx2_vu_exact_div";
|
||||
@@ -1264,7 +1273,7 @@ static void check_variables(bool first_run)
|
||||
setting_vu_exact_div = vu_exact;
|
||||
updated = true;
|
||||
}
|
||||
s_settings_interface.SetBoolValue("EmuCore/CPU/Recompiler", "EnableVuExactDiv", vu_exact);
|
||||
s_option_config.Cpu.Recompiler.EnableVuExactDiv = vu_exact;
|
||||
}
|
||||
|
||||
var.key = "pcsx2_fpu_softfloat";
|
||||
@@ -1276,7 +1285,7 @@ static void check_variables(bool first_run)
|
||||
setting_fpu_softfloat = fpu_soft;
|
||||
updated = true;
|
||||
}
|
||||
s_settings_interface.SetBoolValue("EmuCore/CPU/Recompiler", "EnableFpuSoftFloat", fpu_soft);
|
||||
s_option_config.Cpu.Recompiler.EnableFpuSoftFloat = fpu_soft;
|
||||
}
|
||||
|
||||
var.key = "pcsx2_vu0_softfloat";
|
||||
@@ -1288,7 +1297,7 @@ static void check_variables(bool first_run)
|
||||
setting_vu0_softfloat = vu0_soft;
|
||||
updated = true;
|
||||
}
|
||||
s_settings_interface.SetBoolValue("EmuCore/CPU/Recompiler", "EnableVu0SoftFloat", vu0_soft);
|
||||
s_option_config.Cpu.Recompiler.EnableVu0SoftFloat = vu0_soft;
|
||||
}
|
||||
|
||||
var.key = "pcsx2_vu1_softfloat";
|
||||
@@ -1300,7 +1309,7 @@ static void check_variables(bool first_run)
|
||||
setting_vu1_softfloat = vu1_soft;
|
||||
updated = true;
|
||||
}
|
||||
s_settings_interface.SetBoolValue("EmuCore/CPU/Recompiler", "EnableVu1SoftFloat", vu1_soft);
|
||||
s_option_config.Cpu.Recompiler.EnableVu1SoftFloat = vu1_soft;
|
||||
}
|
||||
|
||||
var.key = "pcsx2_ee_cycle_rate";
|
||||
@@ -1324,7 +1333,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_ee_cycle_rate != ee_cycle_rate_prev)
|
||||
{
|
||||
s_settings_interface.SetIntValue("EmuCore/Speedhacks", "EECycleRate", setting_ee_cycle_rate);
|
||||
s_option_config.Speedhacks.EECycleRate = setting_ee_cycle_rate;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -1346,14 +1355,13 @@ static void check_variables(bool first_run)
|
||||
* raise THREAD_VU1 with no MTVU worker spawned - MainLoop
|
||||
* then waits forever on the handoff (boot hang on <3
|
||||
* hardware threads with pcsx2_mtvu=enabled). */
|
||||
s_settings_interface.SetBoolValue("EmuCore/Speedhacks", "vuThread",
|
||||
mtvu_on && VMManager::MtvuHardwareAllowed());
|
||||
s_option_config.Speedhacks.vuThread = mtvu_on && VMManager::MtvuHardwareAllowed();
|
||||
VMManager::g_MtvuMenuDefault = mtvu_on;
|
||||
}
|
||||
|
||||
var.key = "pcsx2_instant_vu1";
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
s_settings_interface.SetBoolValue("EmuCore/Speedhacks", "vu1Instant", !strcmp(var.value, "enabled"));
|
||||
s_option_config.Speedhacks.vu1Instant = !strcmp(var.value, "enabled");
|
||||
|
||||
/* Fastmem was the one core subsystem with no toggle: every
|
||||
* config a user can build still runs it, which makes a bug in
|
||||
@@ -1367,7 +1375,7 @@ static void check_variables(bool first_run)
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
const bool fastmem_on = !strcmp(var.value, "enabled");
|
||||
s_settings_interface.SetBoolValue("EmuCore/CPU/Recompiler", "EnableFastmem", fastmem_on);
|
||||
s_option_config.Cpu.Recompiler.EnableFastmem = fastmem_on;
|
||||
VMManager::g_FastmemMenuDefault = fastmem_on;
|
||||
}
|
||||
|
||||
@@ -1383,10 +1391,10 @@ static void check_variables(bool first_run)
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
const bool ee_interpreter = !strcmp(var.value, "Interpreter");
|
||||
s_settings_interface.SetBoolValue("EmuCore/CPU/Recompiler", "EnableEE", !ee_interpreter);
|
||||
s_option_config.Cpu.Recompiler.EnableEE = !ee_interpreter;
|
||||
if (ee_interpreter)
|
||||
{
|
||||
s_settings_interface.SetBoolValue("EmuCore/CPU/Recompiler", "EnableFastmem", false);
|
||||
s_option_config.Cpu.Recompiler.EnableFastmem = false;
|
||||
VMManager::g_FastmemMenuDefault = false;
|
||||
}
|
||||
}
|
||||
@@ -1457,8 +1465,7 @@ static void check_variables(bool first_run)
|
||||
|
||||
if (first_run || setting_ee_cycle_skip != ee_cycle_skip_prev)
|
||||
{
|
||||
s_settings_interface.SetIntValue("EmuCore/Speedhacks",
|
||||
"EECycleSkip", setting_ee_cycle_skip);
|
||||
s_option_config.Speedhacks.EECycleSkip = setting_ee_cycle_skip;
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -2541,8 +2548,7 @@ static void libretro_teardown_cpu_thread(void)
|
||||
{
|
||||
VMManager::Internal::CPUThreadShutdown();
|
||||
s_cpu_thread_initialized = false;
|
||||
((LayeredSettingsInterface*)Host::GetSettingsInterface())->SetLayer(
|
||||
LayeredSettingsInterface::LAYER_BASE, nullptr);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2566,13 +2572,11 @@ bool retro_load_game(const struct retro_game_info* game)
|
||||
strlcpy(EmuFolders::Settings, EmuFolders::AppRoot,
|
||||
sizeof(EmuFolders::Settings));
|
||||
|
||||
Host::Internal::SetBaseSettingsLayer(&s_settings_interface);
|
||||
s_option_config = Pcsx2Config();
|
||||
VMManager::ApplyHardwareDefaults(s_option_config);
|
||||
|
||||
EmuFolders::SetDefaults(s_settings_interface);
|
||||
VMManager::SetDefaultSettings(s_settings_interface);
|
||||
|
||||
SettingsInterface* bsi = Host::Internal::GetBaseSettingsLayer();
|
||||
EmuFolders::LoadConfig(*bsi);
|
||||
EmuFolders::LoadConfig(s_option_memcards);
|
||||
EmuFolders::EnsureFoldersExist();
|
||||
VMManager::Internal::CPUThreadInitialize();
|
||||
s_cpu_thread_initialized = true;
|
||||
@@ -2597,24 +2601,24 @@ bool retro_load_game(const struct retro_game_info* game)
|
||||
}
|
||||
|
||||
if (is_software_setting(setting_renderer))
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "Renderer", (int)GSRendererType::SW);
|
||||
s_option_config.GS.Renderer = static_cast<decltype(s_option_config.GS.Renderer)>((int)GSRendererType::SW);
|
||||
|
||||
switch (hw_render.context_type)
|
||||
{
|
||||
case RETRO_HW_CONTEXT_D3D12:
|
||||
if (!is_software_setting(setting_renderer))
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "Renderer", (int)GSRendererType::DX12);
|
||||
s_option_config.GS.Renderer = static_cast<decltype(s_option_config.GS.Renderer)>((int)GSRendererType::DX12);
|
||||
break;
|
||||
case RETRO_HW_CONTEXT_D3D11:
|
||||
if (!is_software_setting(setting_renderer))
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "Renderer", (int)GSRendererType::DX11);
|
||||
s_option_config.GS.Renderer = static_cast<decltype(s_option_config.GS.Renderer)>((int)GSRendererType::DX11);
|
||||
break;
|
||||
#ifdef ENABLE_VULKAN
|
||||
case RETRO_HW_CONTEXT_VULKAN:
|
||||
#ifdef HAVE_PARALLEL_GS
|
||||
if (setting_renderer == "paraLLEl-GS")
|
||||
{
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "Renderer", (int)GSRendererType::ParallelGS);
|
||||
s_option_config.GS.Renderer = static_cast<decltype(s_option_config.GS.Renderer)>((int)GSRendererType::ParallelGS);
|
||||
static const struct retro_hw_render_context_negotiation_interface_vulkan iface = {
|
||||
RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN,
|
||||
RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN_VERSION,
|
||||
@@ -2630,7 +2634,7 @@ bool retro_load_game(const struct retro_game_info* game)
|
||||
#endif
|
||||
{
|
||||
if (!is_software_setting(setting_renderer))
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "Renderer", (int)GSRendererType::VK);
|
||||
s_option_config.GS.Renderer = static_cast<decltype(s_option_config.GS.Renderer)>((int)GSRendererType::VK);
|
||||
{
|
||||
static const struct retro_hw_render_context_negotiation_interface_vulkan iface = {
|
||||
RETRO_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE_VULKAN,
|
||||
@@ -2649,11 +2653,11 @@ bool retro_load_game(const struct retro_game_info* game)
|
||||
#endif
|
||||
case RETRO_HW_CONTEXT_NONE:
|
||||
if (!is_software_setting(setting_renderer))
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "Renderer", (int)GSRendererType::SW);
|
||||
s_option_config.GS.Renderer = static_cast<decltype(s_option_config.GS.Renderer)>((int)GSRendererType::SW);
|
||||
break;
|
||||
default:
|
||||
if (!is_software_setting(setting_renderer))
|
||||
s_settings_interface.SetIntValue("EmuCore/GS", "Renderer", (int)GSRendererType::OGL);
|
||||
s_option_config.GS.Renderer = static_cast<decltype(s_option_config.GS.Renderer)>((int)GSRendererType::OGL);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2666,7 +2670,7 @@ bool retro_load_game(const struct retro_game_info* game)
|
||||
|
||||
environ_cb(RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY, &save_base);
|
||||
|
||||
s_settings_interface.SetStringValue("Folders", "MemoryCards", save_base);
|
||||
strlcpy(s_option_memcards, save_base, sizeof(s_option_memcards));
|
||||
VMManager::Internal::UpdateEmuFolders();
|
||||
|
||||
snprintf(memcard_path, sizeof(memcard_path), "%s", path_basename(game->path));
|
||||
|
||||
+1
-3
@@ -32,7 +32,6 @@
|
||||
|
||||
#include "../../common/Console.h"
|
||||
#include "HostFS.h"
|
||||
#include "../../common/MemorySettingsInterface.h"
|
||||
#include "../../common/StringUtil.h"
|
||||
|
||||
#include "Ps1CD.h"
|
||||
@@ -50,7 +49,6 @@
|
||||
#include "../VMManager.h"
|
||||
|
||||
/* TODO/FIXME - forward declaration */
|
||||
extern MemorySettingsInterface s_settings_interface;
|
||||
|
||||
// This typically reflects the Sony-assigned serial code for the Disc, if one exists.
|
||||
// (examples: SLUS-2113, etc).
|
||||
@@ -344,7 +342,7 @@ static s32 cdvdReadConfig(u8* config)
|
||||
default:
|
||||
{
|
||||
cdvdReadNVM(config, nvmLayout->config1 + (cdvd.CBlockIndex * 16), 16);
|
||||
if (cdvd.CBlockIndex == 1 && (NoOSD || s_settings_interface.GetBoolValue("EmuCore", "EnableFastBoot", false)))
|
||||
if (cdvd.CBlockIndex == 1 && (NoOSD || Host::OptionFastBoot()))
|
||||
{
|
||||
// HACK: Set the "initialized" flag when fast booting, otherwise some games crash (e.g. Jak 1).
|
||||
config[2] |= 0x80;
|
||||
|
||||
@@ -206,8 +206,7 @@ static void ApplyTemplate(char* out, size_t out_size,
|
||||
static void iso2indexname(char* out, size_t out_size, const char* isoname)
|
||||
{
|
||||
ApplyTemplate(out, out_size, "gzip index", EmuFolders::DataRoot,
|
||||
Host::GetBaseStringSettingValue("EmuCore", "GzipIsoIndexTemplate",
|
||||
"$(f).pindex.tmp").c_str(),
|
||||
EmuConfig.GzipIsoIndexTemplate,
|
||||
isoname, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -574,12 +574,9 @@ else()
|
||||
endif()
|
||||
|
||||
list(APPEND pcsx2FrontendSources
|
||||
Frontend/HostSettings.cpp
|
||||
Frontend/LayeredSettingsInterface.cpp
|
||||
VMManager.cpp
|
||||
)
|
||||
list(APPEND pcsx2FrontendHeaders
|
||||
Frontend/LayeredSettingsInterface.h
|
||||
VMManager.h)
|
||||
|
||||
# Linux sources
|
||||
|
||||
+3
-14
@@ -29,8 +29,6 @@
|
||||
#include "../common/General.h"
|
||||
#include "../common/FPControl.h"
|
||||
|
||||
class SettingsInterface;
|
||||
class SettingsWrapper;
|
||||
|
||||
enum class CDVD_SourceType : uint8_t;
|
||||
|
||||
@@ -415,7 +413,6 @@ struct Pcsx2Config
|
||||
RecompilerOptions();
|
||||
void ApplySanityCheck();
|
||||
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
|
||||
bool operator==(const RecompilerOptions& right) const
|
||||
{
|
||||
@@ -458,7 +455,6 @@ struct Pcsx2Config
|
||||
u32 AffinityControlMode;
|
||||
|
||||
CpuOptions();
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
void ApplySanityCheck();
|
||||
|
||||
bool CpusChanged(const CpuOptions& right) const;
|
||||
@@ -573,7 +569,6 @@ struct Pcsx2Config
|
||||
|
||||
GSOptions();
|
||||
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
|
||||
/// Sets user hack values to defaults when user hacks are not enabled.
|
||||
void MaskUserHacks();
|
||||
@@ -665,7 +660,6 @@ struct Pcsx2Config
|
||||
|
||||
DEV9Options();
|
||||
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
|
||||
bool operator==(const DEV9Options& right) const
|
||||
{
|
||||
@@ -737,7 +731,6 @@ struct Pcsx2Config
|
||||
};
|
||||
|
||||
GamefixOptions();
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
GamefixOptions& DisableAll();
|
||||
|
||||
bool Get(GamefixId id) const;
|
||||
@@ -780,7 +773,6 @@ struct Pcsx2Config
|
||||
u8 EECycleSkip; // EE Cycle skip factor (0, 1, 2, or 3)
|
||||
|
||||
SpeedhackOptions();
|
||||
void LoadSave(SettingsWrapper& conf);
|
||||
SpeedhackOptions& DisableAll();
|
||||
|
||||
void Set(SpeedHack id, int value);
|
||||
@@ -799,7 +791,6 @@ struct Pcsx2Config
|
||||
char Bios[PCSX2_PATH_MAX];
|
||||
|
||||
FilenameOptions();
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
|
||||
bool operator==(const FilenameOptions& right) const
|
||||
{
|
||||
@@ -832,7 +823,6 @@ struct Pcsx2Config
|
||||
std::array<Port, NUM_PORTS> Ports;
|
||||
|
||||
USBOptions();
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
|
||||
bool operator==(const USBOptions& right) const;
|
||||
bool operator!=(const USBOptions& right) const;
|
||||
@@ -898,8 +888,6 @@ struct Pcsx2Config
|
||||
char CurrentGameArgs[PCSX2_PATH_MAX];
|
||||
|
||||
Pcsx2Config();
|
||||
void LoadSave(SettingsWrapper& wrap);
|
||||
void LoadSaveMemcards(SettingsWrapper& wrap);
|
||||
|
||||
void FullpathToBios(char* out, size_t out_size) const;
|
||||
void FullpathToMcd(char* out, size_t out_size, uint slot) const;
|
||||
@@ -914,6 +902,8 @@ struct Pcsx2Config
|
||||
|
||||
/// Copies runtime configuration settings (e.g. frame limiter state).
|
||||
void CopyRuntimeConfig(Pcsx2Config& cfg);
|
||||
/* The clamps LoadSave applied after reading, for a config built from options. */
|
||||
void ApplyOptionFixups();
|
||||
};
|
||||
|
||||
extern Pcsx2Config EmuConfig;
|
||||
@@ -936,8 +926,7 @@ namespace EmuFolders
|
||||
extern char Textures[PCSX2_PATH_MAX];
|
||||
|
||||
// Assumes that AppRoot and DataRoot have been initialized.
|
||||
void SetDefaults(SettingsInterface& si);
|
||||
void LoadConfig(SettingsInterface& si);
|
||||
void LoadConfig(const char* memcards);
|
||||
void EnsureFoldersExist();
|
||||
} // namespace EmuFolders
|
||||
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2023 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "HostFS.h"
|
||||
#include "../Frontend/LayeredSettingsInterface.h"
|
||||
#include "../GS.h"
|
||||
#include "../GS/Renderers/HW/GSTextureReplacements.h"
|
||||
#include "../Host.h"
|
||||
#include "../MemoryCardFile.h"
|
||||
#include "../Sio.h"
|
||||
#include "../SLockGuard.h"
|
||||
|
||||
static slock_t* s_settings_mutex(void)
|
||||
{
|
||||
/* First use creates it; C++11 makes the init thread-safe, and there is
|
||||
* no static-init order to worry about. */
|
||||
static slock_t* lock = slock_new();
|
||||
return lock;
|
||||
}
|
||||
static LayeredSettingsInterface s_layered_settings_interface;
|
||||
|
||||
SettingsInterface* Host::GetSettingsInterface()
|
||||
{
|
||||
return &s_layered_settings_interface;
|
||||
}
|
||||
|
||||
std::string Host::GetBaseStringSettingValue(const char* section, const char* key, const char* default_value /*= ""*/)
|
||||
{
|
||||
SLockGuard lock(s_settings_mutex());
|
||||
return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE)->GetStringValue(section, key, default_value);
|
||||
}
|
||||
|
||||
bool Host::GetBoolSettingValue(const char* section, const char* key, bool default_value /*= false*/)
|
||||
{
|
||||
SLockGuard lock(s_settings_mutex());
|
||||
return s_layered_settings_interface.GetBoolValue(section, key, default_value);
|
||||
}
|
||||
|
||||
int Host::GetIntSettingValue(const char* section, const char* key, int default_value /*= 0*/)
|
||||
{
|
||||
SLockGuard lock(s_settings_mutex());
|
||||
return s_layered_settings_interface.GetIntValue(section, key, default_value);
|
||||
}
|
||||
|
||||
uint Host::GetUIntSettingValue(const char* section, const char* key, uint default_value /*= 0*/)
|
||||
{
|
||||
SLockGuard lock(s_settings_mutex());
|
||||
return s_layered_settings_interface.GetUIntValue(section, key, default_value);
|
||||
}
|
||||
|
||||
float Host::GetFloatSettingValue(const char* section, const char* key, float default_value /*= 0.0f*/)
|
||||
{
|
||||
SLockGuard lock(s_settings_mutex());
|
||||
return s_layered_settings_interface.GetFloatValue(section, key, default_value);
|
||||
}
|
||||
|
||||
double Host::GetDoubleSettingValue(const char* section, const char* key, double default_value /*= 0.0f*/)
|
||||
{
|
||||
SLockGuard lock(s_settings_mutex());
|
||||
return s_layered_settings_interface.GetDoubleValue(section, key, default_value);
|
||||
}
|
||||
|
||||
SettingsInterface* Host::Internal::GetBaseSettingsLayer()
|
||||
{
|
||||
return s_layered_settings_interface.GetLayer(LayeredSettingsInterface::LAYER_BASE);
|
||||
}
|
||||
|
||||
void Host::Internal::SetBaseSettingsLayer(SettingsInterface* sif)
|
||||
{
|
||||
s_layered_settings_interface.SetLayer(LayeredSettingsInterface::LAYER_BASE, sif);
|
||||
}
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <compat/strl.h>
|
||||
#include "LayeredSettingsInterface.h"
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
LayeredSettingsInterface::LayeredSettingsInterface() = default;
|
||||
|
||||
LayeredSettingsInterface::~LayeredSettingsInterface() = default;
|
||||
|
||||
bool LayeredSettingsInterface::GetIntValue(const char* section, const char* key, int* value) const
|
||||
{
|
||||
for (u32 layer = FIRST_LAYER; layer <= LAST_LAYER; layer++)
|
||||
{
|
||||
if (SettingsInterface* sif = m_layers[layer])
|
||||
{
|
||||
if (sif->GetIntValue(section, key, value))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LayeredSettingsInterface::GetUIntValue(const char* section, const char* key, uint* value) const
|
||||
{
|
||||
for (u32 layer = FIRST_LAYER; layer <= LAST_LAYER; layer++)
|
||||
{
|
||||
if (SettingsInterface* sif = m_layers[layer])
|
||||
{
|
||||
if (sif->GetUIntValue(section, key, value))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LayeredSettingsInterface::GetFloatValue(const char* section, const char* key, float* value) const
|
||||
{
|
||||
for (u32 layer = FIRST_LAYER; layer <= LAST_LAYER; layer++)
|
||||
{
|
||||
if (SettingsInterface* sif = m_layers[layer])
|
||||
{
|
||||
if (sif->GetFloatValue(section, key, value))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LayeredSettingsInterface::GetDoubleValue(const char* section, const char* key, double* value) const
|
||||
{
|
||||
for (u32 layer = FIRST_LAYER; layer <= LAST_LAYER; layer++)
|
||||
{
|
||||
if (SettingsInterface* sif = m_layers[layer])
|
||||
{
|
||||
if (sif->GetDoubleValue(section, key, value))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LayeredSettingsInterface::GetStringValueBuf(const char* section, const char* key,
|
||||
char* value, size_t value_size, size_t* out_len) const
|
||||
{
|
||||
std::string tmp;
|
||||
|
||||
if (value_size)
|
||||
value[0] = '\0';
|
||||
if (out_len)
|
||||
*out_len = 0;
|
||||
|
||||
if (!GetStringValue(section, key, &tmp))
|
||||
return false;
|
||||
|
||||
if (out_len)
|
||||
*out_len = tmp.size();
|
||||
if (value_size)
|
||||
strlcpy(value, tmp.c_str(), value_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LayeredSettingsInterface::GetBoolValue(const char* section, const char* key, bool* value) const
|
||||
{
|
||||
for (u32 layer = FIRST_LAYER; layer <= LAST_LAYER; layer++)
|
||||
{
|
||||
if (SettingsInterface* sif = m_layers[layer])
|
||||
{
|
||||
if (sif->GetBoolValue(section, key, value))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LayeredSettingsInterface::GetStringValue(const char* section, const char* key, std::string* value) const
|
||||
{
|
||||
for (u32 layer = FIRST_LAYER; layer <= LAST_LAYER; layer++)
|
||||
{
|
||||
if (SettingsInterface* sif = m_layers[layer])
|
||||
{
|
||||
if (sif->GetStringValue(section, key, value))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LayeredSettingsInterface::SetIntValue(const char* section, const char* key, int value)
|
||||
{
|
||||
}
|
||||
|
||||
void LayeredSettingsInterface::SetUIntValue(const char* section, const char* key, uint value)
|
||||
{
|
||||
}
|
||||
|
||||
void LayeredSettingsInterface::SetFloatValue(const char* section, const char* key, float value)
|
||||
{
|
||||
}
|
||||
|
||||
void LayeredSettingsInterface::SetDoubleValue(const char* section, const char* key, double value)
|
||||
{
|
||||
}
|
||||
|
||||
void LayeredSettingsInterface::SetBoolValue(const char* section, const char* key, bool value)
|
||||
{
|
||||
}
|
||||
|
||||
void LayeredSettingsInterface::SetStringValue(const char* section, const char* key, const char* value)
|
||||
{
|
||||
}
|
||||
|
||||
void LayeredSettingsInterface::DeleteValue(const char* section, const char* key)
|
||||
{
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2021 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../../common/SettingsInterface.h"
|
||||
#include <array>
|
||||
|
||||
class LayeredSettingsInterface final : public SettingsInterface
|
||||
{
|
||||
public:
|
||||
enum Layer : u32
|
||||
{
|
||||
LAYER_CMDLINE,
|
||||
LAYER_GAME,
|
||||
LAYER_INPUT,
|
||||
LAYER_BASE,
|
||||
NUM_LAYERS
|
||||
};
|
||||
|
||||
LayeredSettingsInterface();
|
||||
~LayeredSettingsInterface() override;
|
||||
|
||||
SettingsInterface* GetLayer(Layer layer) const { return m_layers[layer]; }
|
||||
void SetLayer(Layer layer, SettingsInterface* sif) { m_layers[layer] = sif; }
|
||||
|
||||
bool GetIntValue(const char* section, const char* key, int* value) const override;
|
||||
bool GetUIntValue(const char* section, const char* key, uint* value) const override;
|
||||
bool GetFloatValue(const char* section, const char* key, float* value) const override;
|
||||
bool GetDoubleValue(const char* section, const char* key, double* value) const override;
|
||||
bool GetBoolValue(const char* section, const char* key, bool* value) const override;
|
||||
bool GetStringValue(const char* section, const char* key, std::string* value) const override;
|
||||
bool GetStringValueBuf(const char* section, const char* key, char* value, size_t value_size, size_t* out_len = NULL) const override;
|
||||
|
||||
void SetIntValue(const char* section, const char* key, int value) override;
|
||||
void SetUIntValue(const char* section, const char* key, uint value) override;
|
||||
void SetFloatValue(const char* section, const char* key, float value) override;
|
||||
void SetDoubleValue(const char* section, const char* key, double value) override;
|
||||
void SetBoolValue(const char* section, const char* key, bool value) override;
|
||||
void SetStringValue(const char* section, const char* key, const char* value) override;
|
||||
void DeleteValue(const char* section, const char* key) override;
|
||||
|
||||
// default parameter overloads
|
||||
using SettingsInterface::GetBoolValue;
|
||||
using SettingsInterface::GetDoubleValue;
|
||||
using SettingsInterface::GetFloatValue;
|
||||
using SettingsInterface::GetIntValue;
|
||||
using SettingsInterface::GetStringValue;
|
||||
using SettingsInterface::GetUIntValue;
|
||||
|
||||
private:
|
||||
static constexpr Layer FIRST_LAYER = LAYER_CMDLINE;
|
||||
static constexpr Layer LAST_LAYER = LAYER_BASE;
|
||||
|
||||
std::array<SettingsInterface*, NUM_LAYERS> m_layers{};
|
||||
};
|
||||
@@ -208,7 +208,7 @@ bool GSDeviceOGL::CheckFeatures(bool& buggy_pbo)
|
||||
|
||||
// Give the user the option to disable PBO usage for downloads.
|
||||
// Most drivers seem to be faster with PBO.
|
||||
m_disable_download_pbo = Host::GetBoolSettingValue("EmuCore/GS", "DisableGLDownloadPBO", false);
|
||||
m_disable_download_pbo = false /* no option sets DisableGLDownloadPBO; this was its default */;
|
||||
if (m_disable_download_pbo)
|
||||
Console.Warning("Not using PBOs for texture downloads, this may reduce performance.");
|
||||
|
||||
|
||||
+7
-11
@@ -23,32 +23,28 @@
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
class SettingsInterface;
|
||||
|
||||
struct Pcsx2Config;
|
||||
namespace Host
|
||||
{
|
||||
/* The frontend's core options, as the config they set, and the three
|
||||
* values beside it that no Pcsx2Config field holds. */
|
||||
const Pcsx2Config& OptionConfig();
|
||||
const char* OptionBiosPath();
|
||||
bool OptionFastBoot();
|
||||
// Base setting retrieval, bypasses layers.
|
||||
std::string GetBaseStringSettingValue(const char* section, const char* key, const char* default_value = "");
|
||||
|
||||
// Allows the emucore to write settings back to the frontend. Use with care.
|
||||
|
||||
// Settings access, thread-safe.
|
||||
bool GetBoolSettingValue(const char* section, const char* key, bool default_value = false);
|
||||
int GetIntSettingValue(const char* section, const char* key, int default_value = 0);
|
||||
uint GetUIntSettingValue(const char* section, const char* key, uint default_value = 0);
|
||||
float GetFloatSettingValue(const char* section, const char* key, float default_value = 0.0f);
|
||||
double GetDoubleSettingValue(const char* section, const char* key, double default_value = 0.0);
|
||||
|
||||
/// Direct access to settings interface. Must hold the lock when calling GetSettingsInterface() and while using it.
|
||||
SettingsInterface* GetSettingsInterface();
|
||||
/// The core options as the config they set; see OptionConfig() below.
|
||||
|
||||
namespace Internal
|
||||
{
|
||||
/// Retrieves the base settings layer. Must call with lock held.
|
||||
SettingsInterface* GetBaseSettingsLayer();
|
||||
|
||||
/// Sets the base settings layer. Should be called by the host at initialization time.
|
||||
void SetBaseSettingsLayer(SettingsInterface* sif);
|
||||
|
||||
} // namespace Internal
|
||||
/// Reads a file from the resources directory of the application.
|
||||
|
||||
+20
-28
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "HostFS.h"
|
||||
#include "../../common/StringUtil.h"
|
||||
#include "../../common/SettingsInterface.h"
|
||||
#include "../../common/Pcsx2Defs.h"
|
||||
|
||||
#include "../Frontend/InputManager.h"
|
||||
@@ -471,31 +470,34 @@ retro_input_state_t PADGetInputStateCallback(void)
|
||||
return input_cb;
|
||||
}
|
||||
|
||||
/* The per-port controller type, as the frontend set it through
|
||||
* retro_set_controller_port_device; port 0 defaults to a DualShock2 and
|
||||
* the others to nothing, as the Pad section's defaults were. The
|
||||
* multitap flags and motor scales had no writer and are the defaults. */
|
||||
static const char* s_pad_type_name[NUM_CONTROLLER_PORTS];
|
||||
|
||||
void retro_set_controller_port_device(unsigned port, unsigned device)
|
||||
{
|
||||
if (pad_type[port] != (int)device)
|
||||
{
|
||||
SettingsInterface* si = Host::Internal::GetBaseSettingsLayer();
|
||||
char section[8];
|
||||
snprintf(section, sizeof(section), "Pad%u", port + 1);
|
||||
pad_type[port] = device;
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
si->SetStringValue(section, "Type", "DualShock2");
|
||||
s_pad_type_name[port] = "DualShock2";
|
||||
USBSetPortDevice(port, USB_DEV_NONE, port);
|
||||
break;
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
/* USB HID keyboard coexists with the DualShock on this slot,
|
||||
* as on real hardware - the pad stays available for menu/pause
|
||||
* navigation while the keyboard drives gameplay. */
|
||||
si->SetStringValue(section, "Type", "DualShock2");
|
||||
s_pad_type_name[port] = "DualShock2";
|
||||
USBSetPortDevice(port, USB_DEV_KEYBOARD, port);
|
||||
break;
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
/* USB HID mouse coexists with the DualShock on this slot. */
|
||||
si->SetStringValue(section, "Type", "DualShock2");
|
||||
s_pad_type_name[port] = "DualShock2";
|
||||
USBSetPortDevice(port, USB_DEV_MOUSE, port);
|
||||
break;
|
||||
case RETRO_DEVICE_KEYBOARD_AND_MOUSE:
|
||||
@@ -504,17 +506,17 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
|
||||
* selected from - the PS2 has only two USB ports. Both read
|
||||
* frontend input from this controller port. The DualShock on
|
||||
* this slot is kept for menu/pause navigation. */
|
||||
si->SetStringValue(section, "Type", "DualShock2");
|
||||
s_pad_type_name[port] = "DualShock2";
|
||||
USBSetPortDevice(0, USB_DEV_KEYBOARD, port);
|
||||
USBSetPortDevice(1, USB_DEV_MOUSE, port);
|
||||
break;
|
||||
default:
|
||||
si->SetStringValue(section, "Type", "None");
|
||||
s_pad_type_name[port] = "None";
|
||||
USBSetPortDevice(port, USB_DEV_NONE, port);
|
||||
break;
|
||||
}
|
||||
|
||||
PAD::LoadConfig(*si);
|
||||
PAD::LoadConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -992,34 +994,24 @@ u8 PADpoll(u8 value)
|
||||
|
||||
bool PADcomplete(void) { return query.queryDone; }
|
||||
|
||||
void PAD::LoadConfig(const SettingsInterface& si)
|
||||
void PAD::LoadConfig()
|
||||
{
|
||||
EmuConfig.MultitapPort0_Enabled = si.GetBoolValue("Pad", "MultitapPort1", false);
|
||||
EmuConfig.MultitapPort1_Enabled = si.GetBoolValue("Pad", "MultitapPort2", false);
|
||||
|
||||
// This is where we would load controller types.
|
||||
EmuConfig.MultitapPort0_Enabled = false;
|
||||
EmuConfig.MultitapPort1_Enabled = false;
|
||||
for (u32 i = 0; i < NUM_CONTROLLER_PORTS; i++)
|
||||
{
|
||||
char section_c[32];
|
||||
snprintf(section_c, sizeof(section_c), "Pad%d", i + 1);
|
||||
const std::string type(si.GetStringValue(section_c, "Type", (i == 0) ? "DualShock2" : "None"));
|
||||
|
||||
const char* type = s_pad_type_name[i] ? s_pad_type_name[i] : ((i == 0) ? "DualShock2" : "None");
|
||||
g_key_status.m_type[i] = NotConnected;
|
||||
|
||||
for (const ControllerInfo& info : s_controller_info)
|
||||
{
|
||||
if (type == info.name)
|
||||
if (!strcmp(type, info.name))
|
||||
{
|
||||
// INI stores a float; snap to the 8.8 grid once, here.
|
||||
const u16 large_motor_scale = (u16)pcsx2_clamp_i(lrintf(si.GetFloatValue(section_c, "LargeMotorScale", DEFAULT_MOTOR_SCALE) * 256.0f), 0, 65535);
|
||||
const u16 small_motor_scale = (u16)pcsx2_clamp_i(lrintf(si.GetFloatValue(section_c, "SmallMotorScale", DEFAULT_MOTOR_SCALE) * 256.0f), 0, 65535);
|
||||
|
||||
const u16 motor_scale = (u16)pcsx2_clamp_i(lrintf(DEFAULT_MOTOR_SCALE * 256.0f), 0, 65535);
|
||||
if (info.vibration_caps != NoVibration)
|
||||
{
|
||||
g_key_status.m_vibration_scale_q8[i][0] = large_motor_scale;
|
||||
g_key_status.m_vibration_scale_q8[i][1] = small_motor_scale;
|
||||
g_key_status.m_vibration_scale_q8[i][0] = motor_scale;
|
||||
g_key_status.m_vibration_scale_q8[i][1] = motor_scale;
|
||||
}
|
||||
|
||||
g_key_status.m_type[i] = info.type;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -37,7 +37,6 @@ enum VibrationCapabilities
|
||||
};
|
||||
|
||||
/* forward declarations */
|
||||
class SettingsInterface;
|
||||
|
||||
/* The state of the PS2 bus */
|
||||
struct QueryInfo
|
||||
@@ -108,7 +107,7 @@ namespace PAD
|
||||
};
|
||||
|
||||
/// Reloads configuration.
|
||||
void LoadConfig(const SettingsInterface& si);
|
||||
void LoadConfig();
|
||||
}
|
||||
|
||||
namespace Input
|
||||
|
||||
+24
-373
@@ -17,8 +17,6 @@
|
||||
#include <float.h>
|
||||
#include <stdint.h>
|
||||
#include "HostFS.h"
|
||||
#include "../common/SettingsInterface.h"
|
||||
#include "../common/SettingsWrapper.h"
|
||||
#include "../common/StringUtil.h"
|
||||
|
||||
#include "Config.h"
|
||||
@@ -196,22 +194,6 @@ Pcsx2Config::SpeedhackOptions& Pcsx2Config::SpeedhackOptions::DisableAll()
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Pcsx2Config::SpeedhackOptions::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
SettingsWrapSection("EmuCore/Speedhacks");
|
||||
|
||||
SettingsWrapBitfield(EECycleRate);
|
||||
SettingsWrapBitfield(EECycleSkip);
|
||||
SettingsWrapBitBool(fastCDVD);
|
||||
SettingsWrapBitBool(IntcStat);
|
||||
SettingsWrapBitBool(WaitLoop);
|
||||
SettingsWrapBitBool(vuFlagHack);
|
||||
SettingsWrapBitBool(vuThread);
|
||||
SettingsWrapBitBool(vu1Instant);
|
||||
|
||||
EECycleRate = pcsx2_clamp_i(EECycleRate, MIN_EE_CYCLE_RATE, MAX_EE_CYCLE_RATE);
|
||||
EECycleSkip = pcsx2_min_i(EECycleSkip, MAX_EE_CYCLE_SKIP);
|
||||
}
|
||||
|
||||
Pcsx2Config::RecompilerOptions::RecompilerOptions()
|
||||
{
|
||||
@@ -304,37 +286,6 @@ void Pcsx2Config::RecompilerOptions::ApplySanityCheck()
|
||||
}
|
||||
}
|
||||
|
||||
void Pcsx2Config::RecompilerOptions::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
SettingsWrapSection("EmuCore/CPU/Recompiler");
|
||||
|
||||
SettingsWrapBitBool(EnableEE);
|
||||
SettingsWrapBitBool(EnableIOP);
|
||||
SettingsWrapBitBool(EnableEECache);
|
||||
SettingsWrapBitBool(EnableFpuSoftFloat);
|
||||
SettingsWrapBitBool(EnableVu0SoftFloat);
|
||||
SettingsWrapBitBool(EnableVu1SoftFloat);
|
||||
SettingsWrapBitBool(EnableVuExactMul);
|
||||
SettingsWrapBitBool(EnableVuExactDiv);
|
||||
SettingsWrapBitBool(EnableVuAccurateAddSub);
|
||||
SettingsWrapBitBool(EnableFpuAccurateArith);
|
||||
SettingsWrapBitBool(EnableVU0);
|
||||
SettingsWrapBitBool(EnableVU1);
|
||||
SettingsWrapBitBool(EnableFastmem);
|
||||
|
||||
SettingsWrapBitBool(vu0Overflow);
|
||||
SettingsWrapBitBool(vu0ExtraOverflow);
|
||||
SettingsWrapBitBool(vu0SignOverflow);
|
||||
SettingsWrapBitBool(vu0Underflow);
|
||||
SettingsWrapBitBool(vu1Overflow);
|
||||
SettingsWrapBitBool(vu1ExtraOverflow);
|
||||
SettingsWrapBitBool(vu1SignOverflow);
|
||||
SettingsWrapBitBool(vu1Underflow);
|
||||
|
||||
SettingsWrapBitBool(fpuOverflow);
|
||||
SettingsWrapBitBool(fpuExtraOverflow);
|
||||
SettingsWrapBitBool(fpuFullMode);
|
||||
}
|
||||
|
||||
bool Pcsx2Config::CpuOptions::CpusChanged(const CpuOptions& right) const
|
||||
{
|
||||
@@ -364,59 +315,6 @@ void Pcsx2Config::CpuOptions::ApplySanityCheck()
|
||||
Recompiler.ApplySanityCheck();
|
||||
}
|
||||
|
||||
void Pcsx2Config::CpuOptions::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
SettingsWrapSection("EmuCore/CPU");
|
||||
|
||||
{
|
||||
FPUFPCR.SetDenormalsAreZero(wrap.EntryBitBool("FPU", "FPU.DenormalsAreZero",
|
||||
FPUFPCR.GetDenormalsAreZero(), FPUFPCR.GetDenormalsAreZero()));
|
||||
FPUFPCR.SetFlushToZero(wrap.EntryBitBool(CURRENT_SETTINGS_SECTION, "FPU.DenormalsAreZero",
|
||||
FPUFPCR.GetFlushToZero(), FPUFPCR.GetFlushToZero()));
|
||||
|
||||
uint round_mode = static_cast<uint>(FPUFPCR.GetRoundMode());
|
||||
wrap.Entry("FPU", "FPU.Roundmode", round_mode, round_mode);
|
||||
round_mode = pcsx2_min_u(round_mode, static_cast<uint>(FPRoundMode::MaxCount) - 1u);
|
||||
FPUFPCR.SetRoundMode(static_cast<FPRoundMode>(round_mode));
|
||||
}
|
||||
{
|
||||
FPUDivFPCR.SetDenormalsAreZero(wrap.EntryBitBool("FPUDiv", "FPUDiv.DenormalsAreZero",
|
||||
FPUDivFPCR.GetDenormalsAreZero(), FPUDivFPCR.GetDenormalsAreZero()));
|
||||
FPUDivFPCR.SetFlushToZero(wrap.EntryBitBool(CURRENT_SETTINGS_SECTION, "FPUDiv.DenormalsAreZero",
|
||||
FPUDivFPCR.GetFlushToZero(), FPUDivFPCR.GetFlushToZero()));
|
||||
|
||||
uint round_mode = static_cast<uint>(FPUDivFPCR.GetRoundMode());
|
||||
wrap.Entry("FPUDiv", "FPUDiv.Roundmode", round_mode, round_mode);
|
||||
round_mode = pcsx2_min_u(round_mode, static_cast<uint>(FPRoundMode::MaxCount) - 1u);
|
||||
FPUDivFPCR.SetRoundMode(static_cast<FPRoundMode>(round_mode));
|
||||
}
|
||||
{
|
||||
VU0FPCR.SetDenormalsAreZero(wrap.EntryBitBool("VU0", "VU0.DenormalsAreZero",
|
||||
VU0FPCR.GetDenormalsAreZero(), VU0FPCR.GetDenormalsAreZero()));
|
||||
VU0FPCR.SetFlushToZero(wrap.EntryBitBool(CURRENT_SETTINGS_SECTION, "VU0.DenormalsAreZero",
|
||||
VU0FPCR.GetFlushToZero(), VU0FPCR.GetFlushToZero()));
|
||||
|
||||
uint round_mode = static_cast<uint>(VU0FPCR.GetRoundMode());
|
||||
wrap.Entry("VU0", "VU0.Roundmode", round_mode, round_mode);
|
||||
round_mode = pcsx2_min_u(round_mode, static_cast<uint>(FPRoundMode::MaxCount) - 1u);
|
||||
VU0FPCR.SetRoundMode(static_cast<FPRoundMode>(round_mode));
|
||||
}
|
||||
{
|
||||
VU1FPCR.SetDenormalsAreZero(wrap.EntryBitBool("VU1", "VU1.DenormalsAreZero",
|
||||
VU1FPCR.GetDenormalsAreZero(), VU1FPCR.GetDenormalsAreZero()));
|
||||
VU1FPCR.SetFlushToZero(wrap.EntryBitBool(CURRENT_SETTINGS_SECTION, "VU1.DenormalsAreZero",
|
||||
VU1FPCR.GetFlushToZero(), VU1FPCR.GetFlushToZero()));
|
||||
|
||||
uint round_mode = static_cast<uint>(VU1FPCR.GetRoundMode());
|
||||
wrap.Entry("VU1", "VU1.Roundmode", round_mode, round_mode);
|
||||
round_mode = pcsx2_min_u(round_mode, static_cast<uint>(FPRoundMode::MaxCount) - 1u);
|
||||
VU1FPCR.SetRoundMode(static_cast<FPRoundMode>(round_mode));
|
||||
}
|
||||
|
||||
SettingsWrapEntry(AffinityControlMode);
|
||||
|
||||
Recompiler.LoadSave(wrap);
|
||||
}
|
||||
|
||||
Pcsx2Config::GSOptions::GSOptions()
|
||||
{
|
||||
@@ -532,84 +430,6 @@ bool Pcsx2Config::GSOptions::RestartOptionsAreEqual(const GSOptions& right) cons
|
||||
OpEqu(OverrideTextureBarriers);
|
||||
}
|
||||
|
||||
void Pcsx2Config::GSOptions::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
SettingsWrapSection("EmuCore/GS");
|
||||
|
||||
SettingsWrapEntry(FramerateNTSC);
|
||||
SettingsWrapEntry(FrameratePAL);
|
||||
|
||||
// Unfortunately, because code in the GS still reads the setting by key instead of
|
||||
// using these variables, we need to use the old names. Maybe post 2.0 we can change this.
|
||||
SettingsWrapBitBoolEx(PCRTCAntiBlur, "pcrtc_antiblur");
|
||||
SettingsWrapBitBoolEx(DisableInterlaceOffset, "disable_interlace_offset");
|
||||
SettingsWrapBitBoolEx(PCRTCOffsets, "pcrtc_offsets");
|
||||
SettingsWrapBitBoolEx(PCRTCOverscan, "pcrtc_overscan");
|
||||
SettingsWrapBitBool(UseDebugDevice);
|
||||
SettingsWrapBitBoolEx(DisableShaderCache, "disable_shader_cache");
|
||||
SettingsWrapBitBool(DisableFramebufferFetch);
|
||||
SettingsWrapBitBool(DisableVertexShaderExpand);
|
||||
SettingsWrapBitBool(SkipDuplicateFrames);
|
||||
|
||||
SettingsWrapBitBoolEx(GPUPaletteConversion, "paltex");
|
||||
SettingsWrapBitBoolEx(AutoFlushSW, "autoflush_sw");
|
||||
SettingsWrapIntEnumEx(PGSSuperSampling, "pgsSuperSampling");
|
||||
SettingsWrapIntEnumEx(PGSHighResScanout, "pgsHighResScanout");
|
||||
SettingsWrapIntEnumEx(PGSDisableMipmaps, "pgsDisableMipmaps");
|
||||
SettingsWrapIntEnumEx(PGSSuperSampleTextures, "pgsSuperSampleTextures");
|
||||
SettingsWrapIntEnumEx(PGSSharpBackbuffer, "pgsSharpBackbuffer");
|
||||
SettingsWrapBitBoolEx(PreloadFrameWithGSData, "preload_frame_with_gs_data");
|
||||
SettingsWrapBitBoolEx(Mipmap, "mipmap");
|
||||
SettingsWrapBitBoolEx(ManualUserHacks, "UserHacks");
|
||||
SettingsWrapBitBoolEx(UserHacks_AlignSpriteX, "UserHacks_align_sprite_X");
|
||||
SettingsWrapIntEnumEx(UserHacks_AutoFlush, "UserHacks_AutoFlushLevel");
|
||||
SettingsWrapBitBoolEx(UserHacks_CPUFBConversion, "UserHacks_CPU_FB_Conversion");
|
||||
SettingsWrapBitBoolEx(UserHacks_ReadTCOnClose, "UserHacks_ReadTCOnClose");
|
||||
SettingsWrapBitBoolEx(UserHacks_DisableDepthSupport, "UserHacks_DisableDepthSupport");
|
||||
SettingsWrapBitBoolEx(UserHacks_DisablePartialInvalidation, "UserHacks_DisablePartialInvalidation");
|
||||
SettingsWrapBitBoolEx(UserHacks_DisableSafeFeatures, "UserHacks_Disable_Safe_Features");
|
||||
SettingsWrapBitBoolEx(UserHacks_DisableRenderFixes, "UserHacks_DisableRenderFixes");
|
||||
SettingsWrapBitBoolEx(UserHacks_MergePPSprite, "UserHacks_merge_pp_sprite");
|
||||
SettingsWrapBitBoolEx(UserHacks_ForceEvenSpritePosition, "UserHacks_ForceEvenSpritePosition");
|
||||
SettingsWrapIntEnumEx(UserHacks_BilinearHack, "UserHacks_BilinearHack");
|
||||
SettingsWrapIntEnumEx(UserHacks_Limit24BitDepth, "UserHacks_Limit24BitDepth");
|
||||
SettingsWrapBitBoolEx(UserHacks_NativePaletteDraw, "UserHacks_NativePaletteDraw");
|
||||
SettingsWrapIntEnumEx(UserHacks_TextureInsideRt, "UserHacks_TextureInsideRt");
|
||||
SettingsWrapBitBoolEx(UserHacks_EstimateTextureRegion, "UserHacks_EstimateTextureRegion");
|
||||
SettingsWrapBitBool(LoadTextureReplacements);
|
||||
SettingsWrapBitBool(LoadTextureReplacementsAsync);
|
||||
SettingsWrapBitBool(PrecacheTextureReplacements);
|
||||
|
||||
SettingsWrapIntEnumEx(InterlaceMode, "deinterlace_mode");
|
||||
|
||||
SettingsWrapIntEnumEx(Renderer, "Renderer");
|
||||
SettingsWrapEntryEx(UpscaleMultiplier, "upscale_multiplier");
|
||||
|
||||
SettingsWrapIntEnumEx(HWMipmapMode, "hw_mipmap_mode");
|
||||
SettingsWrapIntEnumEx(AccurateBlendingUnit, "accurate_blending_unit");
|
||||
SettingsWrapIntEnumEx(TextureFiltering, "filter");
|
||||
SettingsWrapIntEnumEx(TexturePreloading, "texture_preloading");
|
||||
SettingsWrapIntEnumEx(HWDownloadMode, "HWDownloadMode");
|
||||
SettingsWrapBitfieldEx(Dithering, "dithering_ps2");
|
||||
SettingsWrapBitfieldEx(MaxAnisotropy, "MaxAnisotropy");
|
||||
SettingsWrapBitfieldEx(SkipDrawStart, "UserHacks_SkipDraw_Start");
|
||||
SettingsWrapBitfieldEx(SkipDrawEnd, "UserHacks_SkipDraw_End");
|
||||
SkipDrawEnd = pcsx2_max_i(SkipDrawStart, SkipDrawEnd);
|
||||
|
||||
SettingsWrapIntEnumEx(UserHacks_HalfPixelOffset, "UserHacks_HalfPixelOffset");
|
||||
SettingsWrapBitfieldEx(UserHacks_RoundSprite, "UserHacks_round_sprite_offset");
|
||||
SettingsWrapIntEnumEx(UserHacks_NativeScaling, "UserHacks_native_scaling");
|
||||
SettingsWrapBitfieldEx(UserHacks_TCOffsetX, "UserHacks_TCOffsetX");
|
||||
SettingsWrapBitfieldEx(UserHacks_TCOffsetY, "UserHacks_TCOffsetY");
|
||||
SettingsWrapBitfieldEx(UserHacks_CPUSpriteRenderBW, "UserHacks_CPUSpriteRenderBW");
|
||||
SettingsWrapBitfieldEx(UserHacks_CPUSpriteRenderLevel, "UserHacks_CPUSpriteRenderLevel");
|
||||
SettingsWrapBitfieldEx(UserHacks_CPUCLUTRender, "UserHacks_CPUCLUTRender");
|
||||
SettingsWrapIntEnumEx(UserHacks_GPUTargetCLUTMode, "UserHacks_GPUTargetCLUTMode");
|
||||
SettingsWrapIntEnumEx(TriFilter, "TriFilter");
|
||||
SettingsWrapBitfieldEx(OverrideTextureBarriers, "OverrideTextureBarriers");
|
||||
|
||||
SettingsWrapEntry(Adapter);
|
||||
}
|
||||
|
||||
void Pcsx2Config::GSOptions::MaskUserHacks()
|
||||
{
|
||||
@@ -688,91 +508,6 @@ Pcsx2Config::DEV9Options::DEV9Options()
|
||||
HddFile = "DEV9hdd.raw";
|
||||
}
|
||||
|
||||
void Pcsx2Config::DEV9Options::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
{
|
||||
SettingsWrapSection("DEV9/Eth");
|
||||
SettingsWrapEntry(EthEnable);
|
||||
SettingsWrapEnumEx(EthApi, "EthApi", NetApiNames);
|
||||
SettingsWrapEntry(EthDevice);
|
||||
SettingsWrapEntry(EthLogDNS);
|
||||
|
||||
SettingsWrapEntry(InterceptDHCP);
|
||||
|
||||
std::string ps2IPStr = "0.0.0.0";
|
||||
std::string maskStr = "0.0.0.0";
|
||||
std::string gatewayStr = "0.0.0.0";
|
||||
std::string dns1Str = "0.0.0.0";
|
||||
std::string dns2Str = "0.0.0.0";
|
||||
if (wrap.IsSaving())
|
||||
{
|
||||
ps2IPStr = SaveIPHelper(PS2IP);
|
||||
maskStr = SaveIPHelper(Mask);
|
||||
gatewayStr = SaveIPHelper(Gateway);
|
||||
dns1Str = SaveIPHelper(DNS1);
|
||||
dns2Str = SaveIPHelper(DNS2);
|
||||
}
|
||||
SettingsWrapEntryEx(ps2IPStr, "PS2IP");
|
||||
SettingsWrapEntryEx(maskStr, "Mask");
|
||||
SettingsWrapEntryEx(gatewayStr, "Gateway");
|
||||
SettingsWrapEntryEx(dns1Str, "DNS1");
|
||||
SettingsWrapEntryEx(dns2Str, "DNS2");
|
||||
if (wrap.IsLoading())
|
||||
{
|
||||
LoadIPHelper(PS2IP, ps2IPStr);
|
||||
LoadIPHelper(Mask, maskStr);
|
||||
LoadIPHelper(Gateway, gatewayStr);
|
||||
LoadIPHelper(DNS1, dns1Str);
|
||||
LoadIPHelper(DNS2, dns2Str);
|
||||
}
|
||||
|
||||
SettingsWrapEntry(AutoMask);
|
||||
SettingsWrapEntry(AutoGateway);
|
||||
SettingsWrapEnumEx(ModeDNS1, "ModeDNS1", DnsModeNames);
|
||||
SettingsWrapEnumEx(ModeDNS2, "ModeDNS2", DnsModeNames);
|
||||
}
|
||||
|
||||
if (wrap.IsLoading())
|
||||
EthHosts.clear();
|
||||
|
||||
int hostCount = static_cast<int>(EthHosts.size());
|
||||
{
|
||||
SettingsWrapSection("DEV9/Eth/Hosts");
|
||||
SettingsWrapEntryEx(hostCount, "Count");
|
||||
}
|
||||
|
||||
for (int i = 0; i < hostCount; i++)
|
||||
{
|
||||
std::string section = "DEV9/Eth/Hosts/Host" + std::to_string(i);
|
||||
SettingsWrapSection(section.c_str());
|
||||
|
||||
HostEntry entry;
|
||||
if (wrap.IsSaving())
|
||||
entry = EthHosts[i];
|
||||
|
||||
SettingsWrapEntryEx(entry.Url, "Url");
|
||||
SettingsWrapEntryEx(entry.Desc, "Desc");
|
||||
|
||||
std::string addrStr = "0.0.0.0";
|
||||
if (wrap.IsSaving())
|
||||
addrStr = SaveIPHelper(entry.Address);
|
||||
SettingsWrapEntryEx(addrStr, "Address");
|
||||
if (wrap.IsLoading())
|
||||
LoadIPHelper(entry.Address, addrStr);
|
||||
|
||||
SettingsWrapEntryEx(entry.Enabled, "Enabled");
|
||||
|
||||
if (wrap.IsLoading())
|
||||
EthHosts.push_back(entry);
|
||||
}
|
||||
|
||||
{
|
||||
SettingsWrapSection("DEV9/Hdd");
|
||||
SettingsWrapEntry(HddEnable);
|
||||
SettingsWrapEntry(HddFile);
|
||||
SettingsWrapEntry(HddSizeSectors);
|
||||
}
|
||||
}
|
||||
|
||||
void Pcsx2Config::DEV9Options::LoadIPHelper(u8* field, const std::string& setting)
|
||||
{
|
||||
@@ -915,27 +650,6 @@ bool Pcsx2Config::GamefixOptions::Get(GamefixId id) const
|
||||
return false; // unreachable, but we still need to suppress warnings >_<
|
||||
}
|
||||
|
||||
void Pcsx2Config::GamefixOptions::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
SettingsWrapSection("EmuCore/Gamefixes");
|
||||
|
||||
SettingsWrapBitBool(FpuMulHack);
|
||||
SettingsWrapBitBool(XgKickHack);
|
||||
SettingsWrapBitBool(EETimingHack);
|
||||
SettingsWrapBitBool(InstantDMAHack);
|
||||
SettingsWrapBitBool(SkipMPEGHack);
|
||||
SettingsWrapBitBool(OPHFlagHack);
|
||||
SettingsWrapBitBool(DMABusyHack);
|
||||
SettingsWrapBitBool(VIFFIFOHack);
|
||||
SettingsWrapBitBool(VIF1StallHack);
|
||||
SettingsWrapBitBool(GIFFIFOHack);
|
||||
SettingsWrapBitBool(GoemonTlbHack);
|
||||
SettingsWrapBitBool(IbitHack);
|
||||
SettingsWrapBitBool(VUSyncHack);
|
||||
SettingsWrapBitBool(VUOverflowHack);
|
||||
SettingsWrapBitBool(BlitInternalFPSHack);
|
||||
SettingsWrapBitBool(FullVU0SyncHack);
|
||||
}
|
||||
|
||||
Pcsx2Config::FilenameOptions::FilenameOptions()
|
||||
{
|
||||
@@ -943,12 +657,6 @@ Pcsx2Config::FilenameOptions::FilenameOptions()
|
||||
Bios[0] = '\0';
|
||||
}
|
||||
|
||||
void Pcsx2Config::FilenameOptions::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
SettingsWrapSection("Filenames");
|
||||
|
||||
wrap.EntryBuf(CURRENT_SETTINGS_SECTION, "BIOS", Bios, sizeof(Bios), Bios);
|
||||
}
|
||||
|
||||
Pcsx2Config::Pcsx2Config()
|
||||
{
|
||||
@@ -977,62 +685,7 @@ Pcsx2Config::Pcsx2Config()
|
||||
strlcpy(GzipIsoIndexTemplate, "$(f).pindex.tmp", sizeof(GzipIsoIndexTemplate));
|
||||
}
|
||||
|
||||
void Pcsx2Config::LoadSave(SettingsWrapper& wrap)
|
||||
{
|
||||
SettingsWrapSection("EmuCore");
|
||||
|
||||
SettingsWrapBitBool(EnablePatches);
|
||||
SettingsWrapBitBool(EnableCheats);
|
||||
SettingsWrapBitBool(EnableWideScreenPatches);
|
||||
SettingsWrapBitBool(EnableNoInterlacingPatches);
|
||||
SettingsWrapBitBool(EnableGameFixes);
|
||||
SettingsWrapBitBool(HostFs);
|
||||
|
||||
SettingsWrapBitBool(McdEnableEjection);
|
||||
SettingsWrapBitBool(McdFolderAutoManage);
|
||||
|
||||
// Process various sub-components:
|
||||
|
||||
Speedhacks.LoadSave(wrap);
|
||||
Cpu.LoadSave(wrap);
|
||||
GS.LoadSave(wrap);
|
||||
DEV9.LoadSave(wrap);
|
||||
Gamefixes.LoadSave(wrap);
|
||||
|
||||
SettingsWrapEntryBuf(GzipIsoIndexTemplate);
|
||||
|
||||
BaseFilenames.LoadSave(wrap);
|
||||
LoadSaveMemcards(wrap);
|
||||
|
||||
// Per-content memory card
|
||||
if (!libretro_content.empty())
|
||||
{
|
||||
snprintf(EmuConfig.Mcd[0].Filename, sizeof(EmuConfig.Mcd[0].Filename), "%s.ps2", libretro_content.c_str());
|
||||
EmuConfig.Mcd[1].Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Pcsx2Config::LoadSaveMemcards(SettingsWrapper& wrap)
|
||||
{
|
||||
for (uint slot = 0; slot < 2; ++slot)
|
||||
{
|
||||
wrap.Entry("MemoryCards", StringUtil::StdStringFromFormat("Slot%u_Enable", slot + 1).c_str(),
|
||||
Mcd[slot].Enabled, Mcd[slot].Enabled);
|
||||
wrap.EntryBuf("MemoryCards", StringUtil::StdStringFromFormat("Slot%u_Filename", slot + 1).c_str(),
|
||||
Mcd[slot].Filename, sizeof(Mcd[slot].Filename), Mcd[slot].Filename);
|
||||
}
|
||||
|
||||
for (uint slot = 2; slot < 8; ++slot)
|
||||
{
|
||||
int mtport = FileMcd_GetMtapPort(slot) + 1;
|
||||
int mtslot = FileMcd_GetMtapSlot(slot) + 1;
|
||||
|
||||
wrap.Entry("MemoryCards", StringUtil::StdStringFromFormat("Multitap%u_Slot%u_Enable", mtport, mtslot).c_str(),
|
||||
Mcd[slot].Enabled, Mcd[slot].Enabled);
|
||||
wrap.EntryBuf("MemoryCards", StringUtil::StdStringFromFormat("Multitap%u_Slot%u_Filename", mtport, mtslot).c_str(),
|
||||
Mcd[slot].Filename, sizeof(Mcd[slot].Filename), Mcd[slot].Filename);
|
||||
}
|
||||
}
|
||||
|
||||
bool Pcsx2Config::MultitapEnabled(uint port) const
|
||||
{
|
||||
@@ -1085,40 +738,27 @@ void Pcsx2Config::CopyRuntimeConfig(Pcsx2Config& cfg)
|
||||
}
|
||||
}
|
||||
|
||||
void EmuFolders::SetDefaults(SettingsInterface& si)
|
||||
|
||||
/* A folder under DataRoot unless given absolute. */
|
||||
static void SetFolder(char* out, size_t out_size, const char* root, const char* value)
|
||||
{
|
||||
si.SetStringValue("Folders", "Bios", "bios");
|
||||
si.SetStringValue("Folders", "MemoryCards", "memcards");
|
||||
si.SetStringValue("Folders", "Cheats", "cheats");
|
||||
si.SetStringValue("Folders", "CheatsWS", "cheats_ws");
|
||||
si.SetStringValue("Folders", "CheatsNI", "cheats_ni");
|
||||
si.SetStringValue("Folders", "Cache", "cache");
|
||||
si.SetStringValue("Folders", "Textures", "textures");
|
||||
}
|
||||
|
||||
static void LoadPathFromSettings(char* out, size_t out_size,
|
||||
SettingsInterface& si, const char* root, const char* name, const char* def)
|
||||
{
|
||||
char value[PCSX2_PATH_MAX];
|
||||
|
||||
if (!si.GetStringValueBuf("Folders", name, value, sizeof(value)))
|
||||
strlcpy(value, def, sizeof(value));
|
||||
|
||||
if (path_is_absolute(value))
|
||||
strlcpy(out, value, out_size);
|
||||
else
|
||||
pcsx2_path_join(out, out_size, root, value);
|
||||
}
|
||||
|
||||
void EmuFolders::LoadConfig(SettingsInterface& si)
|
||||
void EmuFolders::LoadConfig(const char* memcards)
|
||||
{
|
||||
LoadPathFromSettings(Bios, sizeof(Bios), si, DataRoot, "Bios", "bios");
|
||||
LoadPathFromSettings(MemoryCards, sizeof(MemoryCards), si, DataRoot, "MemoryCards", "memcards");
|
||||
LoadPathFromSettings(Cheats, sizeof(Cheats), si, DataRoot, "Cheats", "cheats");
|
||||
LoadPathFromSettings(CheatsWS, sizeof(CheatsWS), si, DataRoot, "CheatsWS", "cheats_ws");
|
||||
LoadPathFromSettings(CheatsNI, sizeof(CheatsNI), si, DataRoot, "CheatsNI", "cheats_ni");
|
||||
LoadPathFromSettings(Cache, sizeof(Cache), si, DataRoot, "Cache", "cache");
|
||||
LoadPathFromSettings(Textures, sizeof(Textures), si, DataRoot, "Textures", "textures");
|
||||
/* The only folder a core option sets is the memory cards'; the rest
|
||||
* are their defaults under DataRoot. */
|
||||
SetFolder(Bios, sizeof(Bios), DataRoot, "bios");
|
||||
SetFolder(MemoryCards, sizeof(MemoryCards), DataRoot, (memcards && memcards[0]) ? memcards : "memcards");
|
||||
SetFolder(Cheats, sizeof(Cheats), DataRoot, "cheats");
|
||||
SetFolder(CheatsWS, sizeof(CheatsWS), DataRoot, "cheats_ws");
|
||||
SetFolder(CheatsNI, sizeof(CheatsNI), DataRoot, "cheats_ni");
|
||||
SetFolder(Cache, sizeof(Cache), DataRoot, "cache");
|
||||
SetFolder(Textures, sizeof(Textures), DataRoot, "textures");
|
||||
}
|
||||
|
||||
void EmuFolders::EnsureFoldersExist()
|
||||
@@ -1138,3 +778,14 @@ void EmuFolders::EnsureFoldersExist()
|
||||
if (!path_is_valid(Textures))
|
||||
path_mkdir(Textures);
|
||||
}
|
||||
|
||||
/* What LoadSave applied after reading, now applied to the option
|
||||
* config: the two Speedhacks clamps and the SkipDraw ordering. The FPU
|
||||
* control-register and DEV9 address blocks computed from keys no option
|
||||
* set and were identities on the defaults; measured, before this. */
|
||||
void Pcsx2Config::ApplyOptionFixups()
|
||||
{
|
||||
Speedhacks.EECycleRate = pcsx2_clamp_i(Speedhacks.EECycleRate, SpeedhackOptions::MIN_EE_CYCLE_RATE, SpeedhackOptions::MAX_EE_CYCLE_RATE);
|
||||
Speedhacks.EECycleSkip = pcsx2_min_i(Speedhacks.EECycleSkip, SpeedhackOptions::MAX_EE_CYCLE_SKIP);
|
||||
GS.SkipDrawEnd = pcsx2_max_i(GS.SkipDrawStart, GS.SkipDrawEnd);
|
||||
}
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "../Config.h"
|
||||
|
||||
class SettingsInterface;
|
||||
|
||||
namespace USB
|
||||
{
|
||||
@@ -49,34 +48,24 @@ namespace USB
|
||||
void InputDeviceDisconnected(const std::string_view& identifier);
|
||||
|
||||
std::string GetConfigSection(int port);
|
||||
std::string GetConfigDevice(const SettingsInterface& si, u32 port);
|
||||
void SetConfigDevice(SettingsInterface& si, u32 port, const char* devname);
|
||||
u32 GetConfigSubType(const SettingsInterface& si, u32 port, const std::string_view& devname);
|
||||
void SetConfigSubType(SettingsInterface& si, u32 port, const std::string_view& devname, u32 subtype);
|
||||
|
||||
/// Returns the configuration key for the specified bind and device type.
|
||||
std::string GetConfigSubKey(const std::string_view& device, const std::string_view& bind_name);
|
||||
|
||||
/// Performs automatic controller mapping with the provided list of generic mappings.
|
||||
bool MapDevice(SettingsInterface& si, u32 port, const std::vector<std::pair<GenericInputBinding, std::string>>& mapping);
|
||||
|
||||
/// Clears all bindings for a given port.
|
||||
void ClearPortBindings(SettingsInterface& si, u32 port);
|
||||
|
||||
/// Identifies any device/subtype changes and recreates devices.
|
||||
void CheckForConfigChanges(const Pcsx2Config& old_config);
|
||||
|
||||
/// Reads a device-specific configuration boolean.
|
||||
bool GetConfigBool(SettingsInterface& si, u32 port, const char* devname, const char* key, bool default_value);
|
||||
|
||||
/// Reads a device-specific configuration integer.
|
||||
s32 GetConfigInt(SettingsInterface& si, u32 port, const char* devname, const char* key, s32 default_value);
|
||||
|
||||
/// Reads a device-specific configuration floating-point value.
|
||||
float GetConfigFloat(SettingsInterface& si, u32 port, const char* devname, const char* key, float default_value);
|
||||
|
||||
/// Reads a device-specific configuration string.
|
||||
std::string GetConfigString(SettingsInterface& si, u32 port, const char* devname, const char* key, const char* default_value = "");
|
||||
} // namespace USB
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
namespace usb_hid
|
||||
{
|
||||
/* Plain factories - no DeviceProxy / SettingsInterface. Build a boot-
|
||||
/* Plain factories - no DeviceProxy or config lookup. Build a boot-
|
||||
* protocol HID keyboard or mouse on the given OHCI port and return the
|
||||
* USBDevice to attach. */
|
||||
USBDevice* usb_hid_create_kbd(u32 port);
|
||||
|
||||
+17
-57
@@ -25,7 +25,6 @@
|
||||
#include "../common/Console.h"
|
||||
#include "HostFS.h"
|
||||
#include "../common/FPControl.h"
|
||||
#include "../common/SettingsWrapper.h"
|
||||
#include "../common/StringUtil.h" /* StdStringFromFormat */
|
||||
|
||||
#include "Counters.h"
|
||||
@@ -125,7 +124,6 @@ namespace VMManager
|
||||
static void UpdateRunningGame(bool resetting, bool game_starting, bool swapping_disc);
|
||||
|
||||
static void SetTimerResolutionIncreased(bool enabled);
|
||||
static void SetHardwareDependentDefaultSettings(SettingsInterface& si);
|
||||
static void EnsureCPUInfoInitialized();
|
||||
static void SetEmuThreadAffinities();
|
||||
} // namespace VMManager
|
||||
@@ -208,7 +206,6 @@ void VMManager::Internal::UpdateEmuFolders()
|
||||
const std::string old_memcards_directory(EmuFolders::MemoryCards);
|
||||
const std::string old_textures_directory(EmuFolders::Textures);
|
||||
|
||||
EmuFolders::LoadConfig(*Host::Internal::GetBaseSettingsLayer());
|
||||
|
||||
if (VMManager::HasValidVM())
|
||||
{
|
||||
@@ -278,43 +275,19 @@ SysMainMemory& GetVmMemory()
|
||||
return *s_vm_memory;
|
||||
}
|
||||
|
||||
/* The frontend's content name; the first memory card is named after it. */
|
||||
extern std::string libretro_content;
|
||||
|
||||
void VMManager::LoadSettings()
|
||||
{
|
||||
// Switch the rounding mode back to the system default for loading settings.
|
||||
// We might have a different mode, because this can be called during setting updates while a VM is active,
|
||||
// and the rounding mode has an impact on the conversion of floating-point values to/from strings.
|
||||
FPControlRegisterBackup fpcr_backup(FPControlRegister::GetDefault());
|
||||
|
||||
SettingsInterface* si = Host::GetSettingsInterface();
|
||||
SettingsLoadWrapper slw(*si);
|
||||
EmuConfig.LoadSave(slw);
|
||||
PAD::LoadConfig(*si);
|
||||
|
||||
// Remove any user-specified hacks in the config (we don't want stale/conflicting values when it's globally disabled).
|
||||
EmuConfig.GS.MaskUserHacks();
|
||||
EmuConfig.GS.MaskUpscalingHacks();
|
||||
|
||||
// Disable interlacing if we have no-interlacing patches active.
|
||||
if (s_active_no_interlacing_patches > 0 && EmuConfig.GS.InterlaceMode == GSInterlaceMode::Automatic)
|
||||
EmuConfig.GS.InterlaceMode = GSInterlaceMode::Off;
|
||||
|
||||
// Switch to 16:9 if widescreen patches are enabled, and AR is auto.
|
||||
if (s_active_widescreen_patches > 0)
|
||||
EmuConfig = Host::OptionConfig();
|
||||
EmuConfig.ApplyOptionFixups();
|
||||
if (!libretro_content.empty())
|
||||
{
|
||||
/* TODO/FIXME - implement */
|
||||
snprintf(EmuConfig.Mcd[0].Filename, sizeof(EmuConfig.Mcd[0].Filename), "%s.ps2", libretro_content.c_str());
|
||||
EmuConfig.Mcd[1].Enabled = false;
|
||||
}
|
||||
|
||||
/* Ground truth for the run's memory mode: CHECK_FASTMEM compiles
|
||||
* against exactly this value. Printed here, after the settings layer
|
||||
* has landed in EmuConfig, so a log line is proof of mode - the
|
||||
* option plumbing above it has already been wrong twice in ways only
|
||||
* a consumption-point line would have caught. */
|
||||
Console.WriteLn(EmuConfig.Cpu.Recompiler.EnableFastmem
|
||||
? "Fastmem: enabled (pcsx2_fastmem)."
|
||||
: "Fastmem: DISABLED (pcsx2_fastmem) - all accesses take the software memory handlers.");
|
||||
|
||||
if (HasValidVM())
|
||||
ApplyGameFixes();
|
||||
PAD::LoadConfig();
|
||||
}
|
||||
|
||||
void VMManager::ApplyGameFixes()
|
||||
@@ -590,7 +563,7 @@ bool VMManager::AutoDetectSource(const std::string& filename)
|
||||
|
||||
bool VMManager::ApplyBootParameters(VMBootParameters params, std::string* state_to_load)
|
||||
{
|
||||
const bool default_fast_boot = Host::GetBoolSettingValue("EmuCore", "EnableFastBoot", true);
|
||||
const bool default_fast_boot = Host::OptionFastBoot();
|
||||
EmuConfig.UseBOOT2Injection = params.fast_boot.value_or(default_fast_boot);
|
||||
|
||||
s_elf_override = std::move(params.elf_override);
|
||||
@@ -1233,19 +1206,6 @@ void VMManager::ApplySettings()
|
||||
bool VMManager::g_MtvuMenuDefault = true;
|
||||
bool VMManager::g_FastmemMenuDefault = true;
|
||||
|
||||
void VMManager::SetDefaultSettings(SettingsInterface& si)
|
||||
{
|
||||
FPControlRegisterBackup fpcr_backup(FPControlRegister::GetDefault());
|
||||
|
||||
Pcsx2Config temp_config;
|
||||
SettingsSaveWrapper ssw(si);
|
||||
temp_config.LoadSave(ssw);
|
||||
|
||||
// Settings not part of the Pcsx2Config struct.
|
||||
si.SetBoolValue("EmuCore", "EnableFastBoot", true);
|
||||
|
||||
SetHardwareDependentDefaultSettings(si);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -1320,7 +1280,7 @@ static void InitializeCPUInfo(void)
|
||||
* processor list is available everywhere now, but which platforms write
|
||||
* these defaults is a separate question from how the CPU is queried. */
|
||||
#if defined(__linux__) || defined(_WIN32)
|
||||
static void SetMTVUAndAffinityControlDefault(SettingsInterface& si)
|
||||
static void SetMTVUAndAffinityControlDefault(Pcsx2Config& c)
|
||||
{
|
||||
VMManager::EnsureCPUInfoInitialized();
|
||||
// arm64 MTVU status: the worker thread spawns (InitializeCPUProviders) and
|
||||
@@ -1342,7 +1302,7 @@ static void SetMTVUAndAffinityControlDefault(SettingsInterface& si)
|
||||
const bool mtvu = VMManager::MtvuHardwareAllowed() && VMManager::g_MtvuMenuDefault;
|
||||
Console.WriteLn(mtvu ? " MTVU enabled (pcsx2_mtvu; requires >= 3 hardware threads)."
|
||||
: " MTVU disabled.");
|
||||
si.SetBoolValue("EmuCore/Speedhacks", "vuThread", mtvu);
|
||||
c.Speedhacks.vuThread = mtvu;
|
||||
// Instant VU1 assumes the VU1 provider finishes a program quickly (x86
|
||||
// microVU). With the VU1 INTERPRETER, a continuous microprogram (endless
|
||||
// loop streaming XGKICK -- GT3's arcade attract) burns the full
|
||||
@@ -1350,18 +1310,18 @@ static void SetMTVUAndAffinityControlDefault(SettingsInterface& si)
|
||||
// frame inside InterpVU1::Execute and the frontend appears hung. Run VU1
|
||||
// in small interleaved slices instead (upstream's non-instant scheduling).
|
||||
Console.WriteLn(" Instant VU1 enabled (microVU1 native provider).");
|
||||
si.SetBoolValue("EmuCore/Speedhacks", "vu1Instant", true);
|
||||
c.Speedhacks.vu1Instant = true;
|
||||
/* Fastmem follows the same shape as MTVU: this default-setter can run
|
||||
* again on a settings reset after check_variables(true) has consumed
|
||||
* the option, so the option's value has to ride a VMManager global to
|
||||
* survive it. The truthful "which mode is this run in" line lives in
|
||||
* LoadSettings, printed from the config the recompilers actually
|
||||
* read - never from here, where the global may not be fed yet. */
|
||||
si.SetBoolValue("EmuCore/CPU/Recompiler", "EnableFastmem", VMManager::g_FastmemMenuDefault);
|
||||
c.Cpu.Recompiler.EnableFastmem = VMManager::g_FastmemMenuDefault;
|
||||
}
|
||||
|
||||
#else
|
||||
static void SetMTVUAndAffinityControlDefault(SettingsInterface& si) { }
|
||||
static void SetMTVUAndAffinityControlDefault(Pcsx2Config& c) { (void)c; }
|
||||
#endif
|
||||
|
||||
/* Single source of truth for the MTVU hardware gate. The worker is only
|
||||
@@ -1447,9 +1407,9 @@ void VMManager::SetEmuThreadAffinities()
|
||||
sthread_set_affinity(vu1Thread.GetThread(), 0);
|
||||
}
|
||||
|
||||
void VMManager::SetHardwareDependentDefaultSettings(SettingsInterface& si)
|
||||
void VMManager::ApplyHardwareDefaults(Pcsx2Config& c)
|
||||
{
|
||||
SetMTVUAndAffinityControlDefault(si);
|
||||
SetMTVUAndAffinityControlDefault(c);
|
||||
}
|
||||
|
||||
const std::vector<u32>& VMManager::GetSortedProcessorList()
|
||||
|
||||
+4
-1
@@ -112,7 +112,10 @@ namespace VMManager
|
||||
bool ChangeDisc(CDVD_SourceType source, std::string path);
|
||||
|
||||
/// Initializes default configuration in the specified file.
|
||||
void SetDefaultSettings(SettingsInterface& si);
|
||||
/// The defaults that depend on the machine: MTVU and affinity control
|
||||
/// by core count, fastmem by platform. Applied to the option config
|
||||
/// before the options are, so an option still wins.
|
||||
void ApplyHardwareDefaults(Pcsx2Config& c);
|
||||
|
||||
/// Returns a list of processors in the system, and their corresponding affinity mask.
|
||||
/// This list is ordered by most performant to least performant for pinning threads to.
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# Option config: the direct path from core options to Pcsx2Config.
|
||||
set -e
|
||||
DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
ROOT=$(cd "$DIR/../.." && pwd)
|
||||
LC="$ROOT/libretro/libretro-common"
|
||||
SANFLAGS="${SANFLAGS:-}"
|
||||
${CXX:-c++} -std=c++17 -O1 -w $SANFLAGS -I "$ROOT" -I "$ROOT/pcsx2" \
|
||||
-I "$ROOT/common" -I "$ROOT/common/include" -I "$ROOT/3rdparty/include" \
|
||||
-I "$LC/include" \
|
||||
-o "$DIR/settings_optioncfg" "$DIR/optioncfg.cpp" \
|
||||
"$ROOT/pcsx2/Pcsx2Config.cpp" "$ROOT/pcsx2/MemoryCardFile.cpp" \
|
||||
"$ROOT/common/StringUtil.cpp" "$ROOT/common/Console.cpp" \
|
||||
"$LC/string/stdstring.c" "$LC/string/rstrtod.c" "$LC/file/file_path.c" \
|
||||
"$LC/compat/compat_strl.c" "$LC/encodings/encoding_utf.c" "$LC/time/rtime.c" \
|
||||
"$LC/streams/file_stream.c" "$LC/vfs/vfs_implementation.c" "$LC/compat/fopen_utf8.c" \
|
||||
"$LC/file/file_path_io.c" -lpthread
|
||||
"$DIR/settings_optioncfg"
|
||||
@@ -0,0 +1,61 @@
|
||||
/* Option config: the direct path from core options to Pcsx2Config.
|
||||
*
|
||||
* The frontend builds a Pcsx2Config from its options and VMManager copies
|
||||
* it; there is no string map between them any more. What this checks is
|
||||
* the part that used to be LoadSave's and is now code on that config:
|
||||
*
|
||||
* 1. A default Pcsx2Config, through ApplyOptionFixups, is unchanged --
|
||||
* every field an option can set keeps its constructor default when no
|
||||
* option sets it.
|
||||
* 2. The fixups: EECycleRate and EECycleSkip clamp, and SkipDrawEnd is
|
||||
* never below SkipDrawStart -- the three things LoadSave did after
|
||||
* reading, on the values an option can put out of range.
|
||||
* 3. EmuFolders::LoadConfig: an absolute memory-card folder is kept, a
|
||||
* relative one goes under DataRoot, an empty one is DataRoot/memcards.
|
||||
* 4. The BIOS path: the option buffer is PCSX2_PATH_MAX, and a path at
|
||||
* that length is cut, not overrun -- the truncation the old test was
|
||||
* for, on the new surface.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <libretro.h>
|
||||
#include "Config.h"
|
||||
|
||||
retro_log_printf_t log_cb = nullptr;
|
||||
std::string libretro_content;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ok = 1;
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
printf("optioncfg\n");
|
||||
|
||||
{ Pcsx2Config a, b; b.ApplyOptionFixups();
|
||||
int same = (a == b);
|
||||
printf(" %s: default config unchanged by the fixups\n", same ? "ok" : "FAIL"); ok &= same; }
|
||||
|
||||
{ Pcsx2Config c; c.Speedhacks.EECycleRate = 99; c.Speedhacks.EECycleSkip = 99; c.GS.SkipDrawStart = 5; c.GS.SkipDrawEnd = 2;
|
||||
c.ApplyOptionFixups();
|
||||
int good = c.Speedhacks.EECycleRate == Pcsx2Config::SpeedhackOptions::MAX_EE_CYCLE_RATE && c.Speedhacks.EECycleSkip == Pcsx2Config::SpeedhackOptions::MAX_EE_CYCLE_SKIP && c.GS.SkipDrawEnd == 5;
|
||||
printf(" %s: fixups clamp: EECycleRate 99->%d EECycleSkip 99->%d SkipDrawEnd(5,2)->%d\n", good ? "ok" : "FAIL", c.Speedhacks.EECycleRate, c.Speedhacks.EECycleSkip, c.GS.SkipDrawEnd); ok &= good;
|
||||
Pcsx2Config d; d.Speedhacks.EECycleRate = Pcsx2Config::SpeedhackOptions::MIN_EE_CYCLE_RATE - 5; d.ApplyOptionFixups();
|
||||
good = d.Speedhacks.EECycleRate == Pcsx2Config::SpeedhackOptions::MIN_EE_CYCLE_RATE;
|
||||
printf(" %s: EECycleRate below minimum clamps up to %d\n", good ? "ok" : "FAIL", d.Speedhacks.EECycleRate); ok &= good; }
|
||||
|
||||
{ strcpy(EmuFolders::DataRoot, "/data");
|
||||
EmuFolders::LoadConfig("/abs/cards"); int g1 = !strcmp(EmuFolders::MemoryCards, "/abs/cards");
|
||||
EmuFolders::LoadConfig("rel"); int g2 = !strcmp(EmuFolders::MemoryCards, "/data/rel");
|
||||
EmuFolders::LoadConfig(""); int g3 = !strcmp(EmuFolders::MemoryCards, "/data/memcards");
|
||||
int g4 = !strcmp(EmuFolders::Bios, "/data/bios") && !strcmp(EmuFolders::Textures, "/data/textures");
|
||||
printf(" %s: folders: absolute kept, relative under DataRoot, empty -> memcards, others default\n", (g1 && g2 && g3 && g4) ? "ok" : "FAIL"); ok &= g1 && g2 && g3 && g4; }
|
||||
|
||||
{ char buf[PCSX2_PATH_MAX]; std::string longpath(PCSX2_PATH_MAX + 100, 'x');
|
||||
strlcpy(buf, longpath.c_str(), sizeof(buf));
|
||||
int good = strlen(buf) == PCSX2_PATH_MAX - 1 && buf[PCSX2_PATH_MAX - 1] == 0;
|
||||
printf(" %s: a BIOS path longer than the buffer is cut at %d, terminated\n", good ? "ok" : "FAIL", (int)strlen(buf)); ok &= good; }
|
||||
|
||||
printf(ok ? "optioncfg: ok\n" : "optioncfg: FAILED\n");
|
||||
return ok ? 0 : 1;
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/* Settings round trip: write values, read them back, compare.
|
||||
*
|
||||
* The config strings are the one part of this tree the existing gates
|
||||
* cannot see. Frame hashes come from a fixed harness configuration, and the
|
||||
* savestate round trip covers the savestate header, not the ini. A BIOS
|
||||
* path silently truncated at some buffer's length would pass every gate
|
||||
* there is and fail on somebody's deep directory.
|
||||
*
|
||||
* So before Pcsx2Config's std::string fields become fixed buffers, this
|
||||
* establishes what the current implementation does with awkward input:
|
||||
* long paths, UTF-8, embedded separators, empty values. Run it before and
|
||||
* after the conversion; the two must agree.
|
||||
*
|
||||
* cc -o settings_roundtrip settings_roundtrip.cpp \
|
||||
* ../../common/MemorySettingsInterface.cpp ... -I...
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
#include "common/MemorySettingsInterface.h"
|
||||
|
||||
struct tcase
|
||||
{
|
||||
const char *name;
|
||||
const char *value;
|
||||
};
|
||||
|
||||
/* Deliberately awkward: the point is to find where a fixed buffer would
|
||||
* start losing data, not to check that "abc" survives. */
|
||||
static std::string long_path(size_t n)
|
||||
{
|
||||
std::string s = "/home/user";
|
||||
while (s.size() < n)
|
||||
s += "/averyverylongdirectorycomponentname";
|
||||
s.resize(n);
|
||||
return s;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
MemorySettingsInterface si;
|
||||
int fails = 0;
|
||||
int total = 0;
|
||||
|
||||
const std::string p64 = long_path(64);
|
||||
const std::string p128 = long_path(128);
|
||||
const std::string p255 = long_path(255);
|
||||
const std::string p256 = long_path(256);
|
||||
const std::string p511 = long_path(511);
|
||||
const std::string p512 = long_path(512);
|
||||
const std::string p1024 = long_path(1024);
|
||||
|
||||
const tcase cases[] = {
|
||||
{ "empty", "" },
|
||||
{ "short", "scph39001.bin" },
|
||||
{ "spaces", "/home/a b/c d/scph39001.bin" },
|
||||
{ "utf8", "/home/\xc3\xa9\xc3\xa8/bios.bin" },
|
||||
{ "backslash", "C:\\PS2\\bios\\scph39001.bin" },
|
||||
{ "trailing_sep", "/home/user/bios/" },
|
||||
{ "len64", p64.c_str() },
|
||||
{ "len128", p128.c_str() },
|
||||
{ "len255", p255.c_str() },
|
||||
{ "len256", p256.c_str() },
|
||||
{ "len511", p511.c_str() },
|
||||
{ "len512", p512.c_str() },
|
||||
{ "len1024", p1024.c_str() },
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(cases) / sizeof(cases[0]); i++)
|
||||
{
|
||||
std::string got;
|
||||
|
||||
si.SetStringValue("Filenames", cases[i].name, cases[i].value);
|
||||
total++;
|
||||
|
||||
if (!si.GetStringValue("Filenames", cases[i].name, &got))
|
||||
{
|
||||
printf("FAIL %-12s: key missing after set\n", cases[i].name);
|
||||
fails++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (got != cases[i].value)
|
||||
{
|
||||
printf("FAIL %-12s: wrote %zu bytes, read %zu\n",
|
||||
cases[i].name, strlen(cases[i].value), got.size());
|
||||
fails++;
|
||||
}
|
||||
}
|
||||
|
||||
/* A key that was never set must stay unset rather than yielding an
|
||||
* empty string, because the caller distinguishes the two. */
|
||||
{
|
||||
std::string got;
|
||||
total++;
|
||||
if (si.GetStringValue("Filenames", "never_set", &got))
|
||||
{
|
||||
printf("FAIL never_set: reported present\n");
|
||||
fails++;
|
||||
}
|
||||
}
|
||||
|
||||
printf("%d cases, %d failing\n", total, fails);
|
||||
return fails != 0;
|
||||
}
|
||||
Reference in new issue
Block a user