Allow input displays to work without an active movie.
This commit is contained in:
parent
e85438cba0
commit
330ea74d19
|
@ -141,6 +141,8 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
|||
if(!Movie::IsUsingWiimote(0))
|
||||
Movie::InputUpdate();
|
||||
}
|
||||
else
|
||||
Movie::CheckPadStatus(&PadStatus, ISIDevice::m_iDeviceNumber);
|
||||
|
||||
// Thankfully changing mode does not change the high bits ;)
|
||||
_Hi = (u32)((u8)PadStatus.stickY);
|
||||
|
|
|
@ -762,9 +762,9 @@ void Wiimote::Update()
|
|||
}
|
||||
}
|
||||
}
|
||||
if (Movie::IsRecordingInput())
|
||||
if (!Movie::IsPlayingInput())
|
||||
{
|
||||
Movie::RecordWiimote(m_index, data, rptf, m_reg_ir.mode);
|
||||
Movie::CheckWiimoteStatus(m_index, data, rptf, m_reg_ir.mode);
|
||||
}
|
||||
|
||||
// don't send a data report if auto reporting is off
|
||||
|
|
|
@ -104,6 +104,17 @@ void EnsureTmpInputSize(size_t bound)
|
|||
|
||||
std::string GetInputDisplay()
|
||||
{
|
||||
if (!IsPlayingInput() && !IsRecordingInput())
|
||||
{
|
||||
g_numPads = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER)
|
||||
g_numPads |= (1 << i);
|
||||
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)
|
||||
g_numPads |= (1 << (i + 4));
|
||||
}
|
||||
}
|
||||
std::string inputDisplay = "";
|
||||
for (int i = 0; i < 8; ++i)
|
||||
if ((g_numPads & (1 << i)) != 0)
|
||||
|
@ -181,7 +192,6 @@ void Init()
|
|||
{
|
||||
g_bRecordingFromSaveState = false;
|
||||
g_rerecords = 0;
|
||||
g_numPads = 0;
|
||||
g_currentByte = 0;
|
||||
g_currentFrame = 0;
|
||||
g_currentLagCount = 0;
|
||||
|
@ -576,11 +586,8 @@ void SetWiiInputDisplayString(int remoteID, u8* const coreData, u8* const accelD
|
|||
g_InputDisplay[controllerID].append("\n");
|
||||
}
|
||||
|
||||
void RecordInput(SPADStatus *PadStatus, int controllerID)
|
||||
void CheckPadStatus(SPADStatus *PadStatus, int controllerID)
|
||||
{
|
||||
if(!IsRecordingInput() || !IsUsingPad(controllerID))
|
||||
return;
|
||||
|
||||
g_padState.A = ((PadStatus->button & PAD_BUTTON_A) != 0);
|
||||
g_padState.B = ((PadStatus->button & PAD_BUTTON_B) != 0);
|
||||
g_padState.X = ((PadStatus->button & PAD_BUTTON_X) != 0);
|
||||
|
@ -597,7 +604,6 @@ void RecordInput(SPADStatus *PadStatus, int controllerID)
|
|||
g_padState.R = ((PadStatus->button & PAD_TRIGGER_R) != 0);
|
||||
g_padState.TriggerL = PadStatus->triggerLeft;
|
||||
g_padState.TriggerR = PadStatus->triggerRight;
|
||||
g_padState.disc = g_bDiscChange;
|
||||
|
||||
g_padState.AnalogStickX = PadStatus->stickX;
|
||||
g_padState.AnalogStickY = PadStatus->stickY;
|
||||
|
@ -605,28 +611,44 @@ void RecordInput(SPADStatus *PadStatus, int controllerID)
|
|||
g_padState.CStickX = PadStatus->substickX;
|
||||
g_padState.CStickY = PadStatus->substickY;
|
||||
|
||||
SetInputDisplayString(g_padState, controllerID);
|
||||
}
|
||||
|
||||
void RecordInput(SPADStatus *PadStatus, int controllerID)
|
||||
{
|
||||
if (!IsRecordingInput() || !IsUsingPad(controllerID))
|
||||
return;
|
||||
|
||||
CheckPadStatus(PadStatus, controllerID);
|
||||
|
||||
if (g_bDiscChange)
|
||||
{
|
||||
g_padState.disc = g_bDiscChange;
|
||||
g_bDiscChange = false;
|
||||
}
|
||||
|
||||
EnsureTmpInputSize(g_currentByte + 8);
|
||||
memcpy(&(tmpInput[g_currentByte]), &g_padState, 8);
|
||||
g_currentByte += 8;
|
||||
g_totalBytes = g_currentByte;
|
||||
|
||||
SetInputDisplayString(g_padState, controllerID);
|
||||
|
||||
if (g_bDiscChange)
|
||||
{
|
||||
g_bDiscChange = false;
|
||||
}
|
||||
}
|
||||
|
||||
void RecordWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, int irMode)
|
||||
void CheckWiimoteStatus(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, int irMode)
|
||||
{
|
||||
if(!IsRecordingInput() || !IsUsingWiimote(wiimote))
|
||||
return;
|
||||
|
||||
u8* const coreData = rptf.core?(data+rptf.core):NULL;
|
||||
u8* const accelData = rptf.accel?(data+rptf.accel):NULL;
|
||||
u8* const irData = rptf.ir?(data+rptf.ir):NULL;
|
||||
u8 size = rptf.size;
|
||||
SetWiiInputDisplayString(wiimote, coreData, accelData, irData);
|
||||
|
||||
if (IsRecordingInput())
|
||||
RecordWiimote(wiimote, data, size);
|
||||
}
|
||||
|
||||
void RecordWiimote(int wiimote, u8 *data, u8 size)
|
||||
{
|
||||
if(!IsRecordingInput() || !IsUsingWiimote(wiimote))
|
||||
return;
|
||||
|
||||
InputUpdate();
|
||||
EnsureTmpInputSize(g_currentByte + size + 1);
|
||||
|
@ -634,7 +656,6 @@ void RecordWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf
|
|||
memcpy(&(tmpInput[g_currentByte]), data, size);
|
||||
g_currentByte += size;
|
||||
g_totalBytes = g_currentByte;
|
||||
SetWiiInputDisplayString(wiimote, coreData, accelData, irData);
|
||||
}
|
||||
|
||||
void ReadHeader()
|
||||
|
@ -991,7 +1012,6 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
|
|||
}
|
||||
|
||||
SetInputDisplayString(g_padState, controllerID);
|
||||
|
||||
CheckInputEnd();
|
||||
}
|
||||
|
||||
|
@ -1050,7 +1070,7 @@ void EndPlayInput(bool cont)
|
|||
}
|
||||
else if(g_playMode != MODE_NONE)
|
||||
{
|
||||
g_numPads = g_rerecords = 0;
|
||||
g_rerecords = 0;
|
||||
g_currentByte = 0;
|
||||
g_playMode = MODE_NONE;
|
||||
Core::DisplayMessage("Movie End.", 2000);
|
||||
|
|
|
@ -166,7 +166,7 @@ void FrameSkipping();
|
|||
|
||||
bool BeginRecordingInput(int controllers);
|
||||
void RecordInput(SPADStatus *PadStatus, int controllerID);
|
||||
void RecordWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode);
|
||||
void RecordWiimote(int wiimote, u8 *data, u8 size);
|
||||
|
||||
bool PlayInput(const char *filename);
|
||||
void LoadInput(const char *filename);
|
||||
|
@ -179,6 +179,8 @@ void DoState(PointerWrap &p);
|
|||
void CheckMD5();
|
||||
void GetMD5();
|
||||
void Shutdown();
|
||||
void CheckPadStatus(SPADStatus *PadStatus, int controllerID);
|
||||
void CheckWiimoteStatus(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode);
|
||||
|
||||
std::string GetInputDisplay();
|
||||
|
||||
|
|
Loading…
Reference in New Issue