diff --git a/src/pad.c b/src/pad.c index 662993f..ebbdf46 100644 --- a/src/pad.c +++ b/src/pad.c @@ -85,10 +85,16 @@ unsigned char PAD1_poll(unsigned char value) { if (g.CurByte1 == 0) { uint64_t n; - CurCmd = value; g.CurByte1++; n = pad_read(0); + // Don't enable Analog/Vibration for a standard pad + if (buf[0] == 0x41) { + CurCmd = CMD_READ_DATA_AND_VIBRATE; + } else { + CurCmd = value; + } + g.CmdLen1 = 8; switch (CurCmd) @@ -124,7 +130,11 @@ unsigned char PAD1_poll(unsigned char value) { // else FALLTHROUGH case CMD_READ_DATA_AND_VIBRATE: default: - if (buf[0] == 0x41) size_buf = 4; + if (buf[0] == 0x41) + { + g.CmdLen1 = 4; + size_buf = 4; + } for(uint32_t i=0;i> ((7-i-1) * 8)) & 0xFF; @@ -191,7 +201,7 @@ unsigned char PAD2_poll(unsigned char value) { uint64_t n; g.CurByte2++; - n = pad_read(0); + n = pad_read(1); for(int i=0;i<8;i=i+2) { buf[i] = (n >> ((7-i-1) * 8)) & 0xFF; diff --git a/src/port/sdl/port.c b/src/port/sdl/port.c index 183e7a0..668b655 100644 --- a/src/port/sdl/port.c +++ b/src/port/sdl/port.c @@ -549,7 +549,7 @@ uint8_t use_speedup = 0; static uint16_t id=0x5A41,joy_l = 0x8080,joy_r = 0x8080; SDL_Joystick * sdl_joy1; SDL_Joystick * sdl_joy2; -#define joy_commit_range 3276 +#define joy_commit_range 2048 enum { ANALOG_UP = 1, @@ -630,14 +630,8 @@ void pad_update(void) analog1 |= ANALOG_LEFT; } } else { - #ifdef DEBUG - printf("jx 0x%x ",joy_l); - #endif tmp_axis = (axisval + 32768) / 256; joy_l = (joy_l & 0xFF00) | tmp_axis; - #ifdef DEBUG - printf("jx 0x%x tx 0x%x\n",joy_l,tmp_axis); - #endif } break; case 1: /* Y axis*/ @@ -653,14 +647,8 @@ void pad_update(void) analog1 |= ANALOG_UP; } } else { - #ifdef DEBUG - printf("jy 0x%x ",joy_l); - #endif tmp_axis = (axisval + 32768) / 256; joy_l = (joy_l & 0x00FF) | (tmp_axis << 8); - #ifdef DEBUG - printf("jy 0x%x ty 0x%x\n",joy_l,tmp_axis); - #endif } break; case 2: /* X axis */ @@ -823,10 +811,6 @@ void pad_update(void) #endif pad1 = (uint64_t)id<<48 | (uint64_t)buttons<<32 | (uint32_t) joy_r <<16 | (joy_l); - #ifdef DEBUG - printf("id: 0x%x buttons: 0x%x, joy_r: 0x%x joy_l: 0x%x\n",id,buttons,joy_r,joy_l); - printf("pad1: 0x%llx\n",pad1); - #endif } uint64_t pad_read(int num) @@ -935,6 +919,7 @@ int main (int argc, char **argv) Config.FrameLimit = 1; Config.FrameSkip = FRAMESKIP_OFF; Config.AnalogArrow = 0; + Config.Analog_Mode = 0; //zear - Added option to store the last visited directory. strncpy(Config.LastDir, homedir, MAXPATHLEN); /* Defaults to home directory. */ @@ -1032,6 +1017,7 @@ int main (int argc, char **argv) // Load config from file. config_load(); + if (Config.Analog_Mode < 0 || Config.Analog_Mode > 2) Config.Analog_Mode = 0; // Check if LastDir exists. probe_lastdir();