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 committed 2011-02-12 08:25:09 +00:00
1 parent 8895d6a250
commit 94d02a23de
9 files changed
+60 -26

No files matched your search

+2
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);
+1
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;
+1 -1
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);
@@ -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);
}
}
@@ -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));
}
}
}
+6 -5
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() {
+2 -2
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);