Skip to content

Commit

Permalink
input-rec: add back safeguard around controller input hook and dont d…
Browse files Browse the repository at this point in the history
…eref null virtual pads
  • Loading branch information
xTVaser committed May 23, 2022
1 parent 8fb09d0 commit ef32b49
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pcsx2/Recording/InputRecording.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void InputRecording::ControllerInterrupt(u8& data, u8& port, u16& bufCount, u8 b
}
// If the VirtualPad updated the PadData, we have to update the buffer
// before sending it to the game
else if (pads[port].virtualPad->IsShown() && pads[port].virtualPad->UpdateControllerData(bufIndex, pads[port].padData))
else if (pads[port].virtualPad && pads[port].virtualPad->IsShown() && pads[port].virtualPad->UpdateControllerData(bufIndex, pads[port].padData))
bufVal = pads[port].padData->PollControllerData(bufIndex);
}
}
Expand Down
9 changes: 6 additions & 3 deletions pcsx2/Sio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,13 @@ SIO_WRITE sioWriteController(u8 data)

default:
sio.buf[sio.bufCount] = PADpoll(data);
// Only examine controllers 1 / 2
if (sio.slot[sio.port] == 0 || sio.slot[sio.port] == 1)
if (EmuConfig.EnableRecordingTools)
{
g_InputRecording.ControllerInterrupt(data, sio.port, sio.bufCount, sio.buf);
// Only examine controllers 1 / 2
if (sio.slot[sio.port] == 0 || sio.slot[sio.port] == 1)
{
g_InputRecording.ControllerInterrupt(data, sio.port, sio.bufCount, sio.buf);
}
}
break;
}
Expand Down

0 comments on commit ef32b49

Please sign in to comment.