aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorTwinaphex2016-06-18 19:15:13 +0200
committerGitHub2016-06-18 19:15:13 +0200
commit10ed51a07184f5235e1c85cd9995aaa1481e0dca (patch)
treef973933600949b9c5e4bc63f63bc2df075c08a33 /frontend
parent05311a18fb23799776f9552614ef4c5fb5d852fa (diff)
parent73d32d69496795050589cb845ddbd1a074ca3955 (diff)
downloadpcsx_rearmed-10ed51a07184f5235e1c85cd9995aaa1481e0dca.tar.gz
pcsx_rearmed-10ed51a07184f5235e1c85cd9995aaa1481e0dca.tar.bz2
pcsx_rearmed-10ed51a07184f5235e1c85cd9995aaa1481e0dca.zip
Merge pull request #47 from alexis-puska/master
Suppress segmentation fault and crazy integer value.
Diffstat (limited to 'frontend')
-rw-r--r--frontend/plugin.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/frontend/plugin.c b/frontend/plugin.c
index 5663e6d..8914519 100644
--- a/frontend/plugin.c
+++ b/frontend/plugin.c
@@ -49,7 +49,8 @@ extern void CALLBACK SPUasync(unsigned int, unsigned int);
extern int CALLBACK SPUplayCDDAchannel(short *, int);
/* PAD */
-static long PADreadPort1(PadDataS *pad, int pad_index) {
+static long PADreadPort1(PadDataS *pad) {
+ int pad_index = pad->requestPadIndex;
pad->controllerType = in_type[pad_index];
pad->buttonStatus = ~in_keystate[pad_index];
if (multitap1 == 1)
@@ -67,12 +68,9 @@ static long PADreadPort1(PadDataS *pad, int pad_index) {
return 0;
}
-static long PADreadPort2(PadDataS *pad, int pad_index) {
- /* Temporary hack to avoid segfault when pad_index is a crazy number */
- if (pad_index <= 1 || pad_index > 8) {
- pad_index = 1;
- }
-
+static long PADreadPort2(PadDataS *pad) {
+ int pad_index = pad->requestPadIndex;
+
pad->controllerType = in_type[pad_index];
pad->buttonStatus = ~in_keystate[pad_index];
if (multitap2 ==1 )