Allow disabling memory card writes in netplay.

Fixes issue 6217.
This commit is contained in:
John Chadwick 2013-04-07 12:18:07 -04:00 committed by Rachel Bryk
parent 5f32febcf3
commit c7abf7e8d2
7 changed files with 31 additions and 2 deletions

View File

@ -46,7 +46,7 @@ SCoreStartupParameter::SCoreStartupParameter()
bCPUThread(true), bDSPThread(false), bDSPHLE(true),
bSkipIdle(true), bNTSC(false), bForceNTSCJ(false),
bHLE_BS2(true), bEnableCheats(false),
bMergeBlocks(false),
bMergeBlocks(false), bEnableMemcardSaving(true),
bDPL2Decoder(false), iLatency(14),
bRunCompareServer(false), bRunCompareClient(false),
bMMU(false), bDCBZOFF(false), iTLBHack(0), bVBeam(false),
@ -81,6 +81,7 @@ void SCoreStartupParameter::LoadDefaults()
bSyncGPU = false;
bFastDiscSpeed = false;
bMergeBlocks = false;
bEnableMemcardSaving = true;
SelectedLanguage = 0;
bWii = false;
bDPL2Decoder = false;

View File

@ -105,6 +105,7 @@ struct SCoreStartupParameter
bool bHLE_BS2;
bool bEnableCheats;
bool bMergeBlocks;
bool bEnableMemcardSaving;
bool bDPL2Decoder;
int iLatency;

View File

@ -150,6 +150,9 @@ void CEXIMemoryCard::Flush(bool exiting)
if(!m_bDirty)
return;
if (!Core::g_CoreStartupParameter.bEnableMemcardSaving)
return;
if (flushThread.joinable())
{
flushThread.join();

View File

@ -271,6 +271,16 @@ bool NetPlay::StopGame()
return true;
}
void NetPlay::SetMemcardWriteEnabled(bool enabled)
{
std::lock_guard<std::recursive_mutex> lkg(m_crit.game);
if (m_is_running)
{
Core::g_CoreStartupParameter.bEnableMemcardSaving = enabled;
}
}
// called from ---CPU--- thread
u8 NetPlay::GetPadNum(u8 numPAD)
{

View File

@ -111,6 +111,7 @@ public:
virtual bool StartGame(const std::string &path);
virtual bool StopGame();
virtual void SetMemcardWriteEnabled(bool enabled);
//void PushPadStates(unsigned int count);
u8 GetPadNum(u8 numPAD);

View File

@ -22,6 +22,7 @@
#include "NetPlay.h"
#include "NetWindow.h"
#include "Frame.h"
#include "Core.h"
#include <sstream>
#include <string>
@ -333,6 +334,9 @@ NetPlayDiag::NetPlayDiag(wxWindow* const parent, const CGameListCtrl* const game
padbuf_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlayDiag::OnPadBuffHelp, this);
bottom_szr->Add(padbuf_spin, 0, wxCENTER);
bottom_szr->Add(padbuf_btn);
m_memcard_write = new wxCheckBox(panel, wxID_ANY, _("Write memcards (GC)"));
m_memcard_write->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &NetPlayDiag::OnMemcardWriteCheck, this);
bottom_szr->Add(m_memcard_write, 0, wxCENTER);
}
bottom_szr->AddStretchSpacer(1);
@ -397,6 +401,8 @@ void NetPlayDiag::OnStop(wxCommandEvent&)
void NetPlayDiag::BootGame(const std::string& filename)
{
main_frame->BootGame(filename);
Core::g_CoreStartupParameter.bEnableMemcardSaving = m_memcard_write->GetValue();
}
void NetPlayDiag::StopGame()
@ -449,6 +455,11 @@ void NetPlayDiag::OnPadBuffHelp(wxCommandEvent&)
m_chat_text->AppendText(StrToWxStr(ss.str()));
}
void NetPlayDiag::OnMemcardWriteCheck(wxCommandEvent &event)
{
netplay_ptr->SetMemcardWriteEnabled(m_memcard_write->GetValue());
}
void NetPlayDiag::OnAdjustBuffer(wxCommandEvent& event)
{
const int val = ((wxSpinCtrl*)event.GetEventObject())->GetValue();

View File

@ -96,6 +96,7 @@ private:
void OnChat(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);
void OnPadBuffHelp(wxCommandEvent& event);
void OnMemcardWriteCheck(wxCommandEvent& event);
void OnThread(wxCommandEvent& event);
void OnChangeGame(wxCommandEvent& event);
void OnAdjustBuffer(wxCommandEvent& event);
@ -104,6 +105,7 @@ private:
wxListBox* m_player_lbox;
wxTextCtrl* m_chat_text;
wxTextCtrl* m_chat_msg_text;
wxCheckBox* m_memcard_write;
std::string m_selected_game;
wxButton* m_game_btn;