From ef32b49e50b94b027cc9a1da7b7efe5ef14c5e9d Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sun, 22 May 2022 21:58:40 -0400 Subject: [PATCH] input-rec: add back safeguard around controller input hook and dont deref null virtual pads --- pcsx2/Recording/InputRecording.cpp | 2 +- pcsx2/Sio.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pcsx2/Recording/InputRecording.cpp b/pcsx2/Recording/InputRecording.cpp index 5283a1e2ca..a9e6574f58 100644 --- a/pcsx2/Recording/InputRecording.cpp +++ b/pcsx2/Recording/InputRecording.cpp @@ -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); } } diff --git a/pcsx2/Sio.cpp b/pcsx2/Sio.cpp index d5e8a06bab..854943f3aa 100644 --- a/pcsx2/Sio.cpp +++ b/pcsx2/Sio.cpp @@ -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; }