Tweaks to Wii rerecording for general stability and reliability.

* Better control over which Wiimotes save/load input from input files (general sync improvement).
* Wiimote save stores the ACLQ, allowing maintaining control across save/load (thanks to skid for the idea).
* Wiimote reconnect on save/load now an option - enabled by default to preserve present behaviour.  Disabling this allows the above change to be effective.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7147 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
smelenchuk 2011-02-12 08:25:09 +00:00
parent 8895d6a250
commit 94d02a23de
9 changed files with 60 additions and 26 deletions

View File

@ -239,6 +239,7 @@ void SConfig::SaveSettings()
ini.Set("Core", "WiiSDCard", m_WiiSDCard);
ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
ini.Set("Core", "WiimoteReconnectOnLoad", m_WiimoteReconnectOnLoad);
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
ini.Set("Core", "FrameLimit", m_Framelimit);
@ -364,6 +365,7 @@ void SConfig::LoadSettings()
ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false);
ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false);
ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true);
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false);

View File

@ -33,6 +33,7 @@ struct SConfig : NonCopyable
bool m_WiiKeyboard;
bool m_WiiAutoReconnect[4];
bool m_WiiAutoUnpair;
bool m_WiimoteReconnectOnLoad;
// name of the last used filename
std::string m_LastFilename;

View File

@ -104,7 +104,7 @@ void Update(int _number)
}
_last_number = _number;
if ((Frame::IsPlayingInput() && Frame::IsUsingWiimote(_number)) || (!Frame::IsPlayingInput() && (WIIMOTE_SRC_EMU & g_wiimote_sources[_number])))
if (WIIMOTE_SRC_EMU & g_wiimote_sources[_number])
((WiimoteEmu::Wiimote*)g_plugin.controllers[_number])->Update();
else
WiimoteReal::Update(_number);

View File

@ -668,13 +668,9 @@ void Wiimote::Update()
memset(data, 0, sizeof(data));
// figure out what data we need
s8 rptf_size = MAX_PAYLOAD;;
s8 rptf_size = MAX_PAYLOAD;
if (Frame::IsPlayingInput())
{
Frame::PlayWiimote(data, rptf_size);
}
else
if (!Frame::IsPlayingInput() || !Frame::PlayWiimote(m_index, data, rptf_size))
{
const ReportFeatures& rptf = reporting_mode_features[m_reporting_mode - WM_REPORT_CORE];
rptf_size = rptf.size;
@ -782,7 +778,7 @@ void Wiimote::Update()
}
if (Frame::IsRecordingInput())
{
Frame::RecordWiimote(data, rptf_size);
Frame::RecordWiimote(m_index, data, rptf_size);
}
}

View File

@ -111,20 +111,45 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p)
p.Do(m_NumCompPackets_Freq);
p.Do(m_WiimoteUpdate_Freq);
u32 size;
if (p.GetMode() == PointerWrap::MODE_READ)
{
// Reset the connection of all connected wiimotes
for (unsigned int i = 0; i < 4; i++)
u8 buf[sizeof(ACLQ)];
p.Do(size);
while (!m_ACLQ.empty())
m_ACLQ.pop();
for (u32 i = 0; i < size; i++)
{
if (m_WiiMotes[i].IsConnected())
{
m_WiiMotes[i].Activate(false);
m_WiiMotes[i].Activate(true);
}
else
{
m_WiiMotes[i].Activate(false);
}
p.DoVoid((void *)buf, sizeof(ACLQ));
m_ACLQ.push(*(ACLQ *)buf);
}
if (SConfig::GetInstance().m_WiimoteReconnectOnLoad)
{
// Reset the connection of all connected wiimotes
for (unsigned int i = 0; i < 4; i++)
{
if (m_WiiMotes[i].IsConnected())
{
m_WiiMotes[i].Activate(false);
m_WiiMotes[i].Activate(true);
}
else
{
m_WiiMotes[i].Activate(false);
}
}
}
}
else
{
size = m_ACLQ.size();
p.Do(size);
for (u32 i = 0; i < size; i++)
{
ACLQ tmp = m_ACLQ.front();
m_ACLQ.pop();
m_ACLQ.push(tmp);
p.DoVoid((void *)&tmp, sizeof(ACLQ));
}
}
}

View File

@ -239,9 +239,9 @@ void RecordInput(SPADStatus *PadStatus, int controllerID)
fwrite(&g_padState, sizeof(ControllerState), 1, g_recordfd);
}
void RecordWiimote(u8 *data, s8 size)
void RecordWiimote(int wiimote, u8 *data, s8 size)
{
if(!IsRecordingInput())
if(!IsRecordingInput() || !IsUsingWiimote(wiimote))
return;
fwrite(&size, 1, 1, g_recordfd);
@ -409,11 +409,11 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
}
}
void PlayWiimote(u8 *data, s8 &size)
bool PlayWiimote(int wiimote, u8 *data, s8 &size)
{
s8 count = 0;
if(!IsPlayingInput())
return;
if(!IsPlayingInput() || !IsUsingWiimote(wiimote))
return false;
fread(&count, 1, 1, g_recordfd);
size = (count > size) ? size : count;
@ -425,6 +425,7 @@ void PlayWiimote(u8 *data, s8 &size)
Core::DisplayMessage("Movie End", 2000);
EndPlayInput();
}
return true;
}
void EndPlayInput() {

View File

@ -114,12 +114,12 @@ void FrameSkipping();
bool BeginRecordingInput(int controllers);
void RecordInput(SPADStatus *PadStatus, int controllerID);
void RecordWiimote(u8* data, s8 size);
void RecordWiimote(int wiimote, u8* data, s8 size);
bool PlayInput(const char *filename);
void LoadInput(const char *filename);
void PlayController(SPADStatus *PadStatus, int controllerID);
void PlayWiimote(u8* data, s8 &size);
bool PlayWiimote(int wiimote, u8* data, s8 &size);
void EndPlayInput();
void SaveRecording(const char *filename);

View File

@ -163,6 +163,7 @@ EVT_CHOICE(ID_WII_IPL_LNG, CConfigMain::WiiSettingsChanged)
EVT_CHECKBOX(ID_WII_SD_CARD, CConfigMain::WiiSettingsChanged)
EVT_CHECKBOX(ID_WII_KEYBOARD, CConfigMain::WiiSettingsChanged)
EVT_CHECKBOX(ID_WII_WIIMOTE_RECONNECT, CConfigMain::WiiSettingsChanged)
EVT_LISTBOX(ID_ISOPATHS, CConfigMain::ISOPathsSelectionChanged)
@ -500,6 +501,7 @@ void CConfigMain::InitializeGUIValues()
WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData<u8>("BT.BAR"));
WiiSensBarSens->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<u32>("BT.SENS"));
WiimoteMotor->SetValue(SConfig::GetInstance().m_SYSCONF->GetData<bool>("BT.MOT"));
WiimoteReconnectOnLoad->SetValue(SConfig::GetInstance().m_WiimoteReconnectOnLoad);
// Wii - Misc
WiiScreenSaver->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.SSV"));
@ -821,6 +823,7 @@ void CConfigMain::CreateGUIControls()
WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator);
WiiSensBarSens = new wxSlider(WiiPage, ID_WII_BT_SENS, 0, 0, 4);
WiimoteMotor = new wxCheckBox(WiiPage, ID_WII_BT_MOT, _("Wiimote Motor"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
WiimoteReconnectOnLoad = new wxCheckBox(WiiPage, ID_WII_KEYBOARD, _("Reconnect Wiimote On Load State"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// Misc Settings
WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, _("Enable Screen Saver (burn-in reduction)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -841,6 +844,7 @@ void CConfigMain::CreateGUIControls()
wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5);
sWiimoteSettings->Add(WiiSensBarSens, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND|wxALL, 5);
sWiimoteSettings->Add(WiimoteMotor, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
sWiimoteSettings->Add(WiimoteReconnectOnLoad, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5);
sbWiimoteSettings = new wxStaticBoxSizer(wxHORIZONTAL, WiiPage, _("Wiimote Settings"));
sbWiimoteSettings->Add(sWiimoteSettings);
@ -1261,6 +1265,9 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
case ID_WII_BT_MOT:
SConfig::GetInstance().m_SYSCONF->SetData("BT.MOT", WiimoteMotor->IsChecked());
break;
case ID_WII_WIIMOTE_RECONNECT:
SConfig::GetInstance().m_WiimoteReconnectOnLoad = WiimoteReconnectOnLoad->IsChecked();
break;
// SYSCONF settings
case ID_WII_IPL_SSV:
SConfig::GetInstance().m_SYSCONF->SetData("IPL.SSV", WiiScreenSaver->IsChecked());

View File

@ -117,6 +117,7 @@ private:
ID_WII_BT_BAR,
ID_WII_BT_SENS,
ID_WII_BT_MOT,
ID_WII_WIIMOTE_RECONNECT,
ID_WII_IPL_SSV,
ID_WII_IPL_E60,
@ -218,6 +219,7 @@ private:
wxChoice* WiiSensBarPos;
wxSlider* WiiSensBarSens;
wxCheckBox* WiimoteMotor;
wxCheckBox* WiimoteReconnectOnLoad;
// Misc
wxCheckBox* WiiScreenSaver;