Fixing wiimote savestate and recording.
This commit is contained in:
parent
983d5d1f73
commit
470a4eee8b
|
@ -613,7 +613,7 @@ void Wiimote::DoState(PointerWrap& p)
|
|||
p.Do(m_status);
|
||||
p.Do(m_adpcm_state);
|
||||
p.Do(m_ext_key);
|
||||
p.Do(m_eeprom);
|
||||
p.DoArray(m_eeprom, sizeof(m_eeprom));
|
||||
p.Do(m_reg_motion_plus);
|
||||
p.Do(m_reg_ir);
|
||||
p.Do(m_reg_ext);
|
||||
|
|
|
@ -104,14 +104,7 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::~CWII_IPC_HLE_Device_usb_oh1_57e_305()
|
|||
|
||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p)
|
||||
{
|
||||
/*
|
||||
//things that do not get saved: (why not?)
|
||||
|
||||
std::vector<CWII_IPC_HLE_WiiMote> m_WiiMotes;
|
||||
|
||||
std::deque<SQueuedEvent> m_EventQueue;
|
||||
*/
|
||||
|
||||
p.Do(m_Active);
|
||||
p.Do(m_ControllerBD);
|
||||
p.Do(m_CtrlSetup);
|
||||
p.Do(m_ACLSetup);
|
||||
|
@ -120,75 +113,34 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p)
|
|||
p.Do(m_last_ticks);
|
||||
p.DoArray(m_PacketCount,4);
|
||||
p.Do(m_ScanEnable);
|
||||
p.Do(m_EventQueue);
|
||||
m_acl_pool.DoState(p);
|
||||
|
||||
bool storeFullData = (Movie::IsRecordingInput() || Movie::IsPlayingInput());
|
||||
p.Do(storeFullData);
|
||||
p.DoMarker("storeFullData in CWII_IPC_HLE_Device_usb_oh1_57e_305");
|
||||
|
||||
if (!storeFullData)
|
||||
{
|
||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||
{
|
||||
m_EventQueue.clear();
|
||||
|
||||
if (SConfig::GetInstance().m_WiimoteReconnectOnLoad)
|
||||
{
|
||||
// Reset the connection of all connected wiimotes
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
{
|
||||
if (!m_WiiMotes[i].IsInactive())
|
||||
{
|
||||
m_WiiMotes[i].Activate(false);
|
||||
m_WiiMotes[i].Activate(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_WiiMotes[i].Activate(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
{
|
||||
if (p.GetMode() == PointerWrap::MODE_READ && !(WIIMOTE_SRC_EMU == g_wiimote_sources[i] || WIIMOTE_SRC_NONE == g_wiimote_sources[i]))
|
||||
continue;
|
||||
m_WiiMotes[i].DoState(p);
|
||||
}
|
||||
|
||||
// Reset the connection of real and hybrid wiimotes
|
||||
if (p.GetMode() == PointerWrap::MODE_READ && SConfig::GetInstance().m_WiimoteReconnectOnLoad)
|
||||
{
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
{
|
||||
if (WIIMOTE_SRC_EMU == g_wiimote_sources[i] || WIIMOTE_SRC_NONE == g_wiimote_sources[i])
|
||||
continue;
|
||||
// TODO: Selectively clear real wiimote messages if possible. Or create a real wiimote channel and reporting mode pre-setup to vacate the need for m_WiimoteReconnectOnLoad.
|
||||
m_EventQueue.clear();
|
||||
if (!m_WiiMotes[i].IsInactive())
|
||||
{
|
||||
m_WiiMotes[i].Activate(false);
|
||||
m_WiiMotes[i].Activate(true);
|
||||
}
|
||||
else
|
||||
m_WiiMotes[i].Activate(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// I'm not sure why these things aren't normally saved, but I think they can affect the emulation state,
|
||||
// so if sync matters (e.g. if a movie is active), we really should save them.
|
||||
// also, it's definitely not safe to do the above auto-reconnect hack either.
|
||||
// (unless we can do it without changing anything that affects emulation state, which is not currently the case)
|
||||
|
||||
p.Do(m_EventQueue);
|
||||
p.DoMarker("m_EventQueue");
|
||||
|
||||
// m_WiiMotes is kind of annoying to save. maybe this could be done in a more general way.
|
||||
u32 vec_size = (u32)m_WiiMotes.size();
|
||||
p.Do(vec_size);
|
||||
for (u32 i = 0; i < vec_size; ++i)
|
||||
{
|
||||
if (i < m_WiiMotes.size())
|
||||
{
|
||||
CWII_IPC_HLE_WiiMote& wiimote = m_WiiMotes[i];
|
||||
wiimote.DoState(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
bdaddr_t tmpBD = BDADDR_ANY;
|
||||
CWII_IPC_HLE_WiiMote wiimote = CWII_IPC_HLE_WiiMote(this, i, tmpBD, false);
|
||||
wiimote.DoState(p);
|
||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||
{
|
||||
m_WiiMotes.push_back(wiimote);
|
||||
_dbg_assert_(WII_IPC_WIIMOTE, m_WiiMotes.size() == i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||
while ((u32)m_WiiMotes.size() > vec_size)
|
||||
m_WiiMotes.pop_back();
|
||||
p.DoMarker("m_WiiMotes");
|
||||
}
|
||||
|
||||
DoStateShared(p);
|
||||
}
|
||||
|
||||
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::RemoteDisconnect(u16 _connectionHandle)
|
||||
|
|
|
@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
|
|||
static std::thread g_save_thread;
|
||||
|
||||
// Don't forget to increase this after doing changes on the savestate system
|
||||
static const int STATE_VERSION = 9;
|
||||
static const int STATE_VERSION = 10;
|
||||
|
||||
struct StateHeader
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue