Netplay: Get memory card size override setting from config system instead of manually parsing INI.

This commit is contained in:
Admiral H. Curtiss 2022-01-26 00:57:44 +01:00
parent b88507a3ed
commit 407aefb6b9
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
4 changed files with 9 additions and 4 deletions

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

@ -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('.'),