Fix crash on loading savestate with an input movie attatched to it in Gamecube games.
Fixed Gamecube controllers being disconnected for a couple ingame seconds when loading a savestate with an input movie attatched. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7141 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b9ace6d501
commit
6912f0a18c
|
@ -132,19 +132,24 @@ bool IsPlayingInput()
|
|||
|
||||
bool IsUsingPad(int controller)
|
||||
{
|
||||
return (g_numPads & (1 << controller));
|
||||
return ((g_numPads & (1 << controller)) != 0);
|
||||
}
|
||||
|
||||
bool IsUsingWiimote(int wiimote)
|
||||
{
|
||||
return (g_numPads & (1 << (wiimote + 4)));
|
||||
return ((g_numPads & (1 << (wiimote + 4))) != 0);
|
||||
}
|
||||
|
||||
void ChangePads()
|
||||
void ChangePads(bool instantly)
|
||||
{
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
SerialInterface::ChangeDevice(IsUsingPad(i) ? SI_GC_CONTROLLER : SI_NONE, i);
|
||||
if (instantly) // Changes from savestates need to be instantaneous
|
||||
SerialInterface::AddDevice(IsUsingPad(i) ? SI_GC_CONTROLLER : SI_NONE, i);
|
||||
else
|
||||
SerialInterface::ChangeDevice(IsUsingPad(i) ? SI_GC_CONTROLLER : SI_NONE, i);
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeWiiPads()
|
||||
|
@ -301,8 +306,10 @@ void LoadInput(const char *filename)
|
|||
|
||||
g_numPads = header.numControllers;
|
||||
|
||||
ChangePads();
|
||||
ChangeWiiPads();
|
||||
ChangePads(true);
|
||||
|
||||
if (Core::g_CoreStartupParameter.bWii)
|
||||
ChangeWiiPads();
|
||||
|
||||
if (g_recordfd)
|
||||
fclose(g_recordfd);
|
||||
|
@ -420,7 +427,7 @@ void SaveRecording(const char *filename)
|
|||
header.filetype[0] = 'D'; header.filetype[1] = 'T'; header.filetype[2] = 'M'; header.filetype[3] = 0x1A;
|
||||
strncpy((char *)header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6);
|
||||
header.bWii = Core::g_CoreStartupParameter.bWii;
|
||||
header.numControllers = g_numPads;
|
||||
header.numControllers = g_numPads & (Core::g_CoreStartupParameter.bWii ? 0xFF : 0x0F);
|
||||
|
||||
header.bFromSaveState = false; // TODO: add the case where it's true
|
||||
header.frameCount = g_frameCounter;
|
||||
|
|
|
@ -100,7 +100,7 @@ bool IsPlayingInput();
|
|||
|
||||
bool IsUsingPad(int controller);
|
||||
bool IsUsingWiimote(int wiimote);
|
||||
void ChangePads();
|
||||
void ChangePads(bool instantly = false);
|
||||
void ChangeWiiPads();
|
||||
|
||||
void SetFrameStepping(bool bEnabled);
|
||||
|
|
Loading…
Reference in New Issue