Skip to content

Commit

Permalink
Merge pull request #9809 from Techjar/netplay-session-settings
Browse files Browse the repository at this point in the history
Move some NetPlay-specific settings to SessionSettings
  • Loading branch information
leoetlino committed Jun 13, 2021
2 parents 2898cf5 + 0e50206 commit 4cd1567
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 20 deletions.
5 changes: 0 additions & 5 deletions Source/Core/Core/Config/MainSettings.cpp
Expand Up @@ -21,7 +21,6 @@ namespace Config
// Main.Core

const Info<bool> MAIN_SKIP_IPL{{System::Main, "Core", "SkipIPL"}, true};
const Info<bool> MAIN_LOAD_IPL_DUMP{{System::Main, "Core", "LoadIPLDump"}, true};
const Info<PowerPC::CPUCore> MAIN_CPU_CORE{{System::Main, "Core", "CPUCore"},
PowerPC::DefaultCPUCore()};
const Info<bool> MAIN_JIT_FOLLOW_BRANCH{{System::Main, "Core", "JITFollowBranch"}, true};
Expand Down Expand Up @@ -49,9 +48,6 @@ const Info<std::string> MAIN_GCI_FOLDER_A_PATH_OVERRIDE{
{System::Main, "Core", "GCIFolderAPathOverride"}, ""};
const Info<std::string> MAIN_GCI_FOLDER_B_PATH_OVERRIDE{
{System::Main, "Core", "GCIFolderBPathOverride"}, ""};
const Info<bool> MAIN_GCI_FOLDER_CURRENT_GAME_ONLY{
{System::Main, "Core", "GCIFolderCurrentGameOnly"}, false};
const Info<bool> MAIN_CODE_SYNC_OVERRIDE{{System::Main, "Core", "CheatSyncOverride"}, false};
const Info<int> MAIN_SLOT_A{{System::Main, "Core", "SlotA"},
ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER};
const Info<int> MAIN_SLOT_B{{System::Main, "Core", "SlotB"}, ExpansionInterface::EXIDEVICE_NONE};
Expand All @@ -77,7 +73,6 @@ Info<bool> GetInfoForSimulateKonga(u32 channel)
}

const Info<bool> MAIN_WII_SD_CARD{{System::Main, "Core", "WiiSDCard"}, true};
const Info<bool> MAIN_WII_SD_CARD_WRITABLE{{System::Main, "Core", "WiiSDCardWritable"}, true};
const Info<bool> MAIN_WII_KEYBOARD{{System::Main, "Core", "WiiKeyboard"}, false};
const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING{
{System::Main, "Core", "WiimoteContinuousScanning"}, false};
Expand Down
4 changes: 0 additions & 4 deletions Source/Core/Core/Config/MainSettings.h
Expand Up @@ -24,7 +24,6 @@ namespace Config
// Main.Core

extern const Info<bool> MAIN_SKIP_IPL;
extern const Info<bool> MAIN_LOAD_IPL_DUMP;
extern const Info<PowerPC::CPUCore> MAIN_CPU_CORE;
extern const Info<bool> MAIN_JIT_FOLLOW_BRANCH;
extern const Info<bool> MAIN_FASTMEM;
Expand All @@ -48,8 +47,6 @@ extern const Info<std::string> MAIN_AGP_CART_A_PATH;
extern const Info<std::string> MAIN_AGP_CART_B_PATH;
extern const Info<std::string> MAIN_GCI_FOLDER_A_PATH_OVERRIDE;
extern const Info<std::string> MAIN_GCI_FOLDER_B_PATH_OVERRIDE;
extern const Info<bool> MAIN_CODE_SYNC_OVERRIDE;
extern const Info<bool> MAIN_GCI_FOLDER_CURRENT_GAME_ONLY;
extern const Info<int> MAIN_SLOT_A;
extern const Info<int> MAIN_SLOT_B;
extern const Info<int> MAIN_SERIAL_PORT_1;
Expand All @@ -58,7 +55,6 @@ Info<u32> GetInfoForSIDevice(u32 channel);
Info<bool> GetInfoForAdapterRumble(u32 channel);
Info<bool> GetInfoForSimulateKonga(u32 channel);
extern const Info<bool> MAIN_WII_SD_CARD;
extern const Info<bool> MAIN_WII_SD_CARD_WRITABLE;
extern const Info<bool> MAIN_WII_KEYBOARD;
extern const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING;
extern const Info<bool> MAIN_WIIMOTE_ENABLE_SPEAKER;
Expand Down
5 changes: 5 additions & 0 deletions Source/Core/Core/Config/SessionSettings.cpp
Expand Up @@ -11,4 +11,9 @@
namespace Config
{
const Info<bool> SESSION_USE_FMA{{System::Session, "Core", "UseFMA"}, CPUInfo().bFMA};
const Info<bool> SESSION_LOAD_IPL_DUMP{{System::Session, "Core", "LoadIPLDump"}, true};
const Info<bool> SESSION_GCI_FOLDER_CURRENT_GAME_ONLY{
{System::Session, "Core", "GCIFolderCurrentGameOnly"}, false};
const Info<bool> SESSION_CODE_SYNC_OVERRIDE{{System::Session, "Core", "CheatSyncOverride"}, false};
const Info<bool> SESSION_WII_SD_CARD_WRITABLE{{System::Session, "Core", "WiiSDCardWritable"}, true};
} // namespace Config
4 changes: 4 additions & 0 deletions Source/Core/Core/Config/SessionSettings.h
Expand Up @@ -10,4 +10,8 @@
namespace Config
{
extern const Info<bool> SESSION_USE_FMA;
extern const Info<bool> SESSION_LOAD_IPL_DUMP;
extern const Info<bool> SESSION_GCI_FOLDER_CURRENT_GAME_ONLY;
extern const Info<bool> SESSION_CODE_SYNC_OVERRIDE;
extern const Info<bool> SESSION_WII_SD_CARD_WRITABLE;
} // namespace Config
8 changes: 4 additions & 4 deletions Source/Core/Core/ConfigLoaders/NetPlayConfigLoader.cpp
Expand Up @@ -40,7 +40,7 @@ class NetPlayConfigLayerLoader final : public Config::ConfigLayerLoader
layer->Set(Config::MAIN_SLOT_A, static_cast<int>(m_settings.m_EXIDevice[0]));
layer->Set(Config::MAIN_SLOT_B, static_cast<int>(m_settings.m_EXIDevice[1]));
layer->Set(Config::MAIN_SERIAL_PORT_1, static_cast<int>(m_settings.m_EXIDevice[2]));
layer->Set(Config::MAIN_WII_SD_CARD_WRITABLE, m_settings.m_WriteToMemcard);
layer->Set(Config::SESSION_WII_SD_CARD_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);
layer->Set(Config::MAIN_MEM2_SIZE, m_settings.m_Mem2Size);
Expand Down Expand Up @@ -83,7 +83,7 @@ class NetPlayConfigLayerLoader final : public Config::ConfigLayerLoader
layer->Set(Config::MAIN_MMU, m_settings.m_MMU);
layer->Set(Config::MAIN_FASTMEM, m_settings.m_Fastmem);
layer->Set(Config::MAIN_SKIP_IPL, m_settings.m_SkipIPL);
layer->Set(Config::MAIN_LOAD_IPL_DUMP, m_settings.m_LoadIPLDump);
layer->Set(Config::SESSION_LOAD_IPL_DUMP, m_settings.m_LoadIPLDump);

layer->Set(Config::GFX_HACK_DEFER_EFB_COPIES, m_settings.m_DeferEFBCopies);
layer->Set(Config::GFX_HACK_EFB_ACCESS_TILE_SIZE, m_settings.m_EFBAccessTileSize);
Expand Down Expand Up @@ -131,14 +131,14 @@ class NetPlayConfigLayerLoader final : public Config::ConfigLayerLoader
layer->Set(Config::MAIN_MEMCARD_B_PATH, make_memcard_path('B'));
}

layer->Set(Config::MAIN_GCI_FOLDER_CURRENT_GAME_ONLY, true);
layer->Set(Config::SESSION_GCI_FOLDER_CURRENT_GAME_ONLY, true);
}

// Check To Override Client's Cheat Codes
if (m_settings.m_SyncCodes && !m_settings.m_IsHosting)
{
// Raise flag to use host's codes
layer->Set(Config::MAIN_CODE_SYNC_OVERRIDE, true);
layer->Set(Config::SESSION_CODE_SYNC_OVERRIDE, true);
}
}

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Core/HW/EXI/EXI_DeviceIPL.cpp
Expand Up @@ -21,7 +21,7 @@
#include "Common/Swap.h"
#include "Common/Timer.h"

#include "Core/Config/MainSettings.h"
#include "Core/Config/SessionSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/CoreTiming.h"
Expand Down Expand Up @@ -106,7 +106,7 @@ CEXIIPL::CEXIIPL()

// Load whole ROM dump
// Note: The Wii doesn't have a copy of the IPL, only fonts.
if (!SConfig::GetInstance().bWii && Config::Get(Config::MAIN_LOAD_IPL_DUMP) &&
if (!SConfig::GetInstance().bWii && Config::Get(Config::SESSION_LOAD_IPL_DUMP) &&
LoadFileToIPL(SConfig::GetInstance().m_strBootROM, 0))
{
// Descramble the encrypted section (contains BS1 and BS2)
Expand Down Expand Up @@ -207,7 +207,7 @@ void CEXIIPL::LoadFontFile(const std::string& filename, u32 offset)
// in some titles. This function check if the user has IPL dumps available and load the fonts
// from those dumps instead of loading the bundled fonts

if (!Config::Get(Config::MAIN_LOAD_IPL_DUMP))
if (!Config::Get(Config::SESSION_LOAD_IPL_DUMP))
{
// IPL loading disabled, load bundled font instead
LoadFileToIPL(filename, offset);
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp
Expand Up @@ -30,6 +30,7 @@
#include "Common/Timer.h"

#include "Core/Config/MainSettings.h"
#include "Core/Config/SessionSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/HW/EXI/EXI_DeviceIPL.h"
Expand Down Expand Up @@ -164,7 +165,7 @@ GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot,
File::IOFile((m_save_directory + MC_HDR), "rb").ReadBytes(&m_hdr, Memcard::BLOCK_SIZE);
}

const bool current_game_only = Config::Get(Config::MAIN_GCI_FOLDER_CURRENT_GAME_ONLY);
const bool current_game_only = Config::Get(Config::SESSION_GCI_FOLDER_CURRENT_GAME_ONLY);
std::vector<std::string> filenames = Common::DoFileSearch({m_save_directory}, {".gci"});

// split up into files for current games we should definitely load,
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/NetPlayServer.cpp
Expand Up @@ -1290,7 +1290,7 @@ bool NetPlayServer::SetupNetSettings()
settings.m_MMU = Config::Get(Config::MAIN_MMU);
settings.m_Fastmem = Config::Get(Config::MAIN_FASTMEM);
settings.m_SkipIPL = Config::Get(Config::MAIN_SKIP_IPL) || !DoAllPlayersHaveIPLDump();
settings.m_LoadIPLDump = Config::Get(Config::MAIN_LOAD_IPL_DUMP) && DoAllPlayersHaveIPLDump();
settings.m_LoadIPLDump = Config::Get(Config::SESSION_LOAD_IPL_DUMP) && DoAllPlayersHaveIPLDump();
settings.m_VertexRounding = Config::Get(Config::GFX_HACK_VERTEX_ROUDING);
settings.m_InternalResolution = Config::Get(Config::GFX_EFB_SCALE);
settings.m_EFBScaledCopy = Config::Get(Config::GFX_HACK_COPY_EFB_SCALED);
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/PatchEngine.cpp
Expand Up @@ -21,7 +21,7 @@

#include "Core/ActionReplay.h"
#include "Core/CheatCodes.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/SessionSettings.h"
#include "Core/ConfigManager.h"
#include "Core/GeckoCode.h"
#include "Core/GeckoCodeConfig.h"
Expand Down Expand Up @@ -165,7 +165,7 @@ void LoadPatches()
LoadPatchSection("OnFrame", s_on_frame, globalIni, localIni);

// Check if I'm syncing Codes
if (Config::Get(Config::MAIN_CODE_SYNC_OVERRIDE))
if (Config::Get(Config::SESSION_CODE_SYNC_OVERRIDE))
{
Gecko::SetSyncedCodesAsActive();
ActionReplay::SetSyncedCodesAsActive();
Expand Down

0 comments on commit 4cd1567

Please sign in to comment.