Merge pull request #10395 from AdmiralCurtiss/memcard-size-setting

Port memory card size override setting to new config system.
This commit is contained in:
Admiral H. Curtiss 2022-01-29 22:32:00 +01:00 committed by GitHub
commit 63df67b7c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 8 deletions

View File

@ -88,6 +88,8 @@ const Info<std::string>& GetInfoForGCIPathOverride(ExpansionInterface::Slot slot
return *infos[slot];
}
const Info<int> MAIN_MEMORY_CARD_SIZE{{System::Main, "Core", "MemoryCardSize"}, -1};
const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_A{
{System::Main, "Core", "SlotA"}, ExpansionInterface::EXIDeviceType::MemoryCardFolder};
const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_B{{System::Main, "Core", "SlotB"},

View File

@ -73,6 +73,7 @@ const Info<std::string>& GetInfoForAGPCartPath(ExpansionInterface::Slot slot);
extern const Info<std::string> MAIN_GCI_FOLDER_A_PATH_OVERRIDE;
extern const Info<std::string> MAIN_GCI_FOLDER_B_PATH_OVERRIDE;
const Info<std::string>& GetInfoForGCIPathOverride(ExpansionInterface::Slot slot);
extern const Info<int> MAIN_MEMORY_CARD_SIZE;
extern const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_A;
extern const Info<ExpansionInterface::EXIDeviceType> MAIN_SLOT_B;
extern const Info<ExpansionInterface::EXIDeviceType> MAIN_SERIAL_PORT_1;

View File

@ -40,6 +40,7 @@ public:
layer->Set(Config::MAIN_OVERCLOCK, m_settings.m_OCFactor);
for (ExpansionInterface::Slot slot : ExpansionInterface::SLOTS)
layer->Set(Config::GetInfoForEXIDevice(slot), m_settings.m_EXIDevice[slot]);
layer->Set(Config::MAIN_MEMORY_CARD_SIZE, m_settings.m_MemcardSizeOverride);
layer->Set(Config::SESSION_SAVE_DATA_WRITABLE, m_settings.m_WriteToMemcard);
layer->Set(Config::MAIN_RAM_OVERRIDE_ENABLE, m_settings.m_RAMOverrideEnable);
layer->Set(Config::MAIN_MEM1_SIZE, m_settings.m_Mem1Size);

View File

@ -8,7 +8,6 @@
#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/IniFile.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
@ -114,9 +113,7 @@ void Init()
{
u16 size_mbits = Memcard::MBIT_SIZE_MEMORY_CARD_2043;
int size_override;
IniFile gameIni = SConfig::GetInstance().LoadGameIni();
gameIni.GetOrCreateSection("Core")->Get("MemoryCardSize", &size_override, -1);
int size_override = Config::Get(Config::MAIN_MEMORY_CARD_SIZE);
if (size_override >= 0 && size_override <= 4)
size_mbits = Memcard::MBIT_SIZE_MEMORY_CARD_59 << size_override;
const bool shift_jis =

View File

@ -822,6 +822,8 @@ void NetPlayClient::OnStartGame(sf::Packet& packet)
for (auto slot : ExpansionInterface::SLOTS)
packet >> m_net_settings.m_EXIDevice[slot];
packet >> m_net_settings.m_MemcardSizeOverride;
for (u32& value : m_net_settings.m_SYSCONFSettings)
packet >> value;

View File

@ -47,6 +47,7 @@ struct NetSettings
bool m_OCEnable = false;
float m_OCFactor = 0;
Common::EnumMap<ExpansionInterface::EXIDeviceType, ExpansionInterface::MAX_SLOT> m_EXIDevice{};
int m_MemcardSizeOverride = -1;
std::array<u32, Config::SYSCONF_SETTINGS.size()> m_SYSCONFSettings{};

View File

@ -1324,6 +1324,8 @@ bool NetPlayServer::SetupNetSettings()
settings.m_EXIDevice[slot] = device;
}
settings.m_MemcardSizeOverride = Config::Get(Config::MAIN_MEMORY_CARD_SIZE);
for (size_t i = 0; i < Config::SYSCONF_SETTINGS.size(); ++i)
{
std::visit(
@ -1510,6 +1512,8 @@ bool NetPlayServer::StartGame()
for (auto slot : ExpansionInterface::SLOTS)
spac << static_cast<int>(m_settings.m_EXIDevice[slot]);
spac << m_settings.m_MemcardSizeOverride;
for (u32 value : m_settings.m_SYSCONFSettings)
spac << value;
@ -1674,10 +1678,7 @@ bool NetPlayServer::SyncSaveData()
MemoryCard::CheckPath(path, region, slot);
int size_override;
IniFile gameIni = SConfig::LoadGameIni(game->GetGameID(), game->GetRevision());
gameIni.GetOrCreateSection("Core")->Get("MemoryCardSize", &size_override, -1);
const int size_override = m_settings.m_MemcardSizeOverride;
if (size_override >= 0 && size_override <= 4)
{
path.insert(path.find_last_of('.'),