mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Merge pull request #11048 from AdmiralCurtiss/netplay-settings-boot-data
Netplay: Pass netplay settings via BootSessionData.
This commit is contained in:
commit
427dd75dfd
@ -50,6 +50,7 @@ namespace fs = std::filesystem;
|
|||||||
#include "Core/IOS/IOS.h"
|
#include "Core/IOS/IOS.h"
|
||||||
#include "Core/IOS/IOSC.h"
|
#include "Core/IOS/IOSC.h"
|
||||||
#include "Core/IOS/Uids.h"
|
#include "Core/IOS/Uids.h"
|
||||||
|
#include "Core/NetPlayProto.h"
|
||||||
#include "Core/PatchEngine.h"
|
#include "Core/PatchEngine.h"
|
||||||
#include "Core/PowerPC/PPCAnalyst.h"
|
#include "Core/PowerPC/PPCAnalyst.h"
|
||||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||||
@ -176,6 +177,16 @@ void BootSessionData::SetWiiSyncData(std::unique_ptr<IOS::HLE::FS::FileSystem> f
|
|||||||
m_wii_sync_cleanup = std::move(cleanup);
|
m_wii_sync_cleanup = std::move(cleanup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const NetPlay::NetSettings* BootSessionData::GetNetplaySettings() const
|
||||||
|
{
|
||||||
|
return m_netplay_settings.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BootSessionData::SetNetplaySettings(std::unique_ptr<NetPlay::NetSettings> netplay_settings)
|
||||||
|
{
|
||||||
|
m_netplay_settings = std::move(netplay_settings);
|
||||||
|
}
|
||||||
|
|
||||||
BootParameters::BootParameters(Parameters&& parameters_, BootSessionData boot_session_data_)
|
BootParameters::BootParameters(Parameters&& parameters_, BootSessionData boot_session_data_)
|
||||||
: parameters(std::move(parameters_)), boot_session_data(std::move(boot_session_data_))
|
: parameters(std::move(parameters_)), boot_session_data(std::move(boot_session_data_))
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,11 @@ struct RegionSetting
|
|||||||
|
|
||||||
class BootExecutableReader;
|
class BootExecutableReader;
|
||||||
|
|
||||||
|
namespace NetPlay
|
||||||
|
{
|
||||||
|
struct NetSettings;
|
||||||
|
}
|
||||||
|
|
||||||
enum class DeleteSavestateAfterBoot : u8
|
enum class DeleteSavestateAfterBoot : u8
|
||||||
{
|
{
|
||||||
No,
|
No,
|
||||||
@ -71,6 +76,9 @@ public:
|
|||||||
void SetWiiSyncData(std::unique_ptr<IOS::HLE::FS::FileSystem> fs, std::vector<u64> titles,
|
void SetWiiSyncData(std::unique_ptr<IOS::HLE::FS::FileSystem> fs, std::vector<u64> titles,
|
||||||
std::string redirect_folder, WiiSyncCleanupFunction cleanup);
|
std::string redirect_folder, WiiSyncCleanupFunction cleanup);
|
||||||
|
|
||||||
|
const NetPlay::NetSettings* GetNetplaySettings() const;
|
||||||
|
void SetNetplaySettings(std::unique_ptr<NetPlay::NetSettings> netplay_settings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::optional<std::string> m_savestate_path;
|
std::optional<std::string> m_savestate_path;
|
||||||
DeleteSavestateAfterBoot m_delete_savestate = DeleteSavestateAfterBoot::No;
|
DeleteSavestateAfterBoot m_delete_savestate = DeleteSavestateAfterBoot::No;
|
||||||
@ -79,6 +87,8 @@ private:
|
|||||||
std::vector<u64> m_wii_sync_titles;
|
std::vector<u64> m_wii_sync_titles;
|
||||||
std::string m_wii_sync_redirect_folder;
|
std::string m_wii_sync_redirect_folder;
|
||||||
WiiSyncCleanupFunction m_wii_sync_cleanup;
|
WiiSyncCleanupFunction m_wii_sync_cleanup;
|
||||||
|
|
||||||
|
std::unique_ptr<NetPlay::NetSettings> m_netplay_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BootParameters
|
struct BootParameters
|
||||||
|
@ -86,9 +86,12 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
|||||||
|
|
||||||
if (NetPlay::IsNetPlayRunning())
|
if (NetPlay::IsNetPlayRunning())
|
||||||
{
|
{
|
||||||
const NetPlay::NetSettings& netplay_settings = NetPlay::GetNetSettings();
|
const NetPlay::NetSettings* netplay_settings = boot->boot_session_data.GetNetplaySettings();
|
||||||
Config::AddLayer(ConfigLoaders::GenerateNetPlayConfigLoader(netplay_settings));
|
if (!netplay_settings)
|
||||||
StartUp.bCopyWiiSaveNetplay = netplay_settings.m_CopyWiiSave;
|
return false;
|
||||||
|
|
||||||
|
Config::AddLayer(ConfigLoaders::GenerateNetPlayConfigLoader(*netplay_settings));
|
||||||
|
StartUp.bCopyWiiSaveNetplay = netplay_settings->m_CopyWiiSave;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1725,6 +1725,8 @@ bool NetPlayClient::StartGame(const std::string& path)
|
|||||||
if (File::Exists(redirect_path))
|
if (File::Exists(redirect_path))
|
||||||
File::DeleteDirRecursively(redirect_path);
|
File::DeleteDirRecursively(redirect_path);
|
||||||
});
|
});
|
||||||
|
boot_session_data->SetNetplaySettings(std::make_unique<NetPlay::NetSettings>(m_net_settings));
|
||||||
|
|
||||||
m_dialog->BootGame(path, std::move(boot_session_data));
|
m_dialog->BootGame(path, std::move(boot_session_data));
|
||||||
|
|
||||||
UpdateDevices();
|
UpdateDevices();
|
||||||
@ -2574,12 +2576,6 @@ bool IsNetPlayRunning()
|
|||||||
return netplay_client != nullptr;
|
return netplay_client != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NetSettings& GetNetSettings()
|
|
||||||
{
|
|
||||||
ASSERT(IsNetPlayRunning());
|
|
||||||
return netplay_client->GetNetSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetSIPollBatching(bool state)
|
void SetSIPollBatching(bool state)
|
||||||
{
|
{
|
||||||
s_si_poll_batching = state;
|
s_si_poll_batching = state;
|
||||||
@ -2622,7 +2618,7 @@ std::string GetGBASavePath(int pad_num)
|
|||||||
{
|
{
|
||||||
std::lock_guard lk(crit_netplay_client);
|
std::lock_guard lk(crit_netplay_client);
|
||||||
|
|
||||||
if (!netplay_client || NetPlay::GetNetSettings().m_IsHosting)
|
if (!netplay_client || netplay_client->GetNetSettings().m_IsHosting)
|
||||||
{
|
{
|
||||||
#ifdef HAS_LIBMGBA
|
#ifdef HAS_LIBMGBA
|
||||||
std::string rom_path = Config::Get(Config::MAIN_GBA_ROM_PATHS[pad_num]);
|
std::string rom_path = Config::Get(Config::MAIN_GBA_ROM_PATHS[pad_num]);
|
||||||
@ -2632,7 +2628,7 @@ std::string GetGBASavePath(int pad_num)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NetPlay::GetNetSettings().m_SyncSaveData)
|
if (!netplay_client->GetNetSettings().m_SyncSaveData)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
return fmt::format("{}{}{}.sav", File::GetUserPath(D_GBAUSER_IDX), GBA_SAVE_NETPLAY, pad_num + 1);
|
return fmt::format("{}{}{}.sav", File::GetUserPath(D_GBAUSER_IDX), GBA_SAVE_NETPLAY, pad_num + 1);
|
||||||
|
@ -257,9 +257,6 @@ std::string GetPlayerMappingString(PlayerId pid, const PadMappingArray& pad_map,
|
|||||||
const GBAConfigArray& gba_config,
|
const GBAConfigArray& gba_config,
|
||||||
const PadMappingArray& wiimote_map);
|
const PadMappingArray& wiimote_map);
|
||||||
bool IsNetPlayRunning();
|
bool IsNetPlayRunning();
|
||||||
// Precondition: A netplay client instance must be present. In other words,
|
|
||||||
// IsNetPlayRunning() must be true before calling this.
|
|
||||||
const NetSettings& GetNetSettings();
|
|
||||||
void SetSIPollBatching(bool state);
|
void SetSIPollBatching(bool state);
|
||||||
void SendPowerButtonEvent();
|
void SendPowerButtonEvent();
|
||||||
bool IsSyncingAllWiiSaves();
|
bool IsSyncingAllWiiSaves();
|
||||||
|
Loading…
Reference in New Issue
Block a user