X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=input%2Fpowerpad.c;h=ca58ee7810659ce9aae0288bd589b2b576783a8b;hp=3c613f9f9d3c7762995248ceca440f9aaeac2c19;hb=e328100eecae3adfce1c3b57364bee5d166217ef;hpb=f12b1f316ca070bda860108b4e3901628d1a8398 diff --git a/input/powerpad.c b/input/powerpad.c index 3c613f9..ca58ee7 100644 --- a/input/powerpad.c +++ b/input/powerpad.c @@ -1,7 +1,7 @@ /* FCE Ultra - NES/Famicom Emulator * * Copyright notice for this file: - * Copyright (C) 2002 Ben Parnell + * Copyright (C) 2002 Xodnizel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,10 +19,11 @@ */ #include -#include -#include "share.h" +#include +#include "share.h" +static char side; static uint32 pprsb[2]; static uint32 pprdata[2]; @@ -37,7 +38,8 @@ static uint8 FP_FASTAPASS(1) ReadPP(int w) if(pprsb[w]>=8) ret|=0x08; } - pprsb[w]++; + if(!fceuindbg) + pprsb[w]++; return ret; } @@ -48,13 +50,36 @@ static void FP_FASTAPASS(1) StrobePP(int w) void FP_FASTAPASS(3) UpdatePP(int w, void *data, int arg) { - pprdata[w]=*(uint32 *)data; + static const char shifttableA[12]={8,9,0,1,11,7,4,2,10,6,5,3}; + static const char shifttableB[12]={1,0,9,8,2,4,7,11,3,5,6,10}; + int x; + + pprdata[w]=0; + + if(side=='A') + for(x=0;x<12;x++) + pprdata[w]|=(((*(uint32 *)data)>>x)&1)<>x)&1)<