Views: 6,699,848 Homepage | Main | Rules/FAQ | Memberlist | Active users | Last posts | Calendar | Stats | Online users | Search 03-28-24 08:12 PM
Guest:

0 users reading D-Pads help | 1 bot

Main - Compatibility / Testing - D-Pads help Hide post layouts | New reply


thelittlejungler
Posted on 09-03-18 01:17 PM Link | #645
So, im new here on the fórum and i need some help if you can provide it to me.
My issue is that i used to have an usb ps2 controller, but now it is broken (im wornking on it) and i have to use one that i had home, the problema is that i cant map the d-pad onto the input settings of melonds. I looked for that issue, but the answeres never seemed to help.

PS: My d-pads worked as i tested them out of the emulator.

Arisotura
Posted on 09-03-18 01:44 PM Link | #646
your dpad might be recognized as a 2-axis joystick, dunno

____________________
Kuribo64

thelittlejungler
Posted on 09-04-18 12:30 AM Link | #647
Hum, I Know the dpad configs, but i dont know how to apply them on the emulator, u yried editing te config file manualy but nothing happens.

Arisotura
Posted on 09-04-18 12:46 AM Link | #648
what do you mean by that? in the emulator, those are the up/down/left/right key mappings

____________________
Kuribo64

thelittlejungler
Posted on 09-04-18 07:07 PM Link | #649
yea i know, but is there some way of reconfiguring without going to the key mappings tab? because that tab doesnt recognise my dpad, thats the issue.

Arisotura
Posted on 09-04-18 07:13 PM Link | #650
does your joystick have multiple dpads? melonDS is set to use the first one.

____________________
Kuribo64

thelittlejungler
Posted on 09-04-18 07:32 PM Link | #651
my joystick its na usb ps1 controller so just 1 dpad ( i think i forgot to mention it).

thelittlejungler
Posted on 09-07-18 12:06 AM Link | #652
Joy_Right=HAxis 1
Joy_Left=IHAxis 1
Joy_Up=IHAxis 2
Joy_Down=HAxis 2
this might be useful

Arisotura
Posted on 09-07-18 09:39 AM Link | #653
that's not how the config works, those entries only take numbers

for reference, here is how they are encoded:

Joy_xxxx=N

button: N = button number from 0

dpad: N = 256 + direction, like

u8 blackhat = SDL_JoystickGetHat(joy, 0);
if (blackhat)
{
if (blackhat & 0x1) blackhat = 0x1;
else if (blackhat & 0x2) blackhat = 0x2;
else if (blackhat & 0x4) blackhat = 0x4;
else blackhat = 0x8;

joymap[id] = 0x100 | blackhat;

...
}



something that'd be helpful here, would be

go in the config panel and open the properties page for your joystick, y'know, where it shows the buttons and axes and all

and take a screenshot of that

so we can see what your dpad is recognized as

____________________
Kuribo64

thelittlejungler
Posted on 09-07-18 01:53 PM Link | #654
i dont know how to pick images here so ima just let the link of the print here
https://drive.google.com/open?id=1q3g-KPSGBUur2kQWoHwWpib-Ux0lW_wB
it is in portuguese but i think you can understand the importante things there (Eixo = Axes)

as i never used python im not familiar with it.

Arisotura
Posted on 09-07-18 02:05 PM Link | #655
yeah that's what I thought-- the dpad is recognized as a 2-axis joystick.

seeing as that's the only one there, you can just leave directional keys unconfigured-- melonDS recognizes a 2-axis joystick automatically and lets you use that for dpad keys.

____________________
Kuribo64

thelittlejungler
Posted on 09-07-18 02:21 PM Link | #656
the problema is that i let it unconfigured and it doesnt get recognised as an input like the other button and the axes are working i tested it on a program already but it seems that i cant get it working on the emulator u.u

Arisotura
Posted on 09-07-18 02:50 PM Link | #657
shiiiiiiiiiiiit

I just realized, my code is flawed in a dumb way

if (Joystick)
{
SDL_JoystickUpdate();

Uint32 hat = SDL_JoystickGetHat(Joystick, 0);
Sint16 axisX = SDL_JoystickGetAxis(Joystick, 0);
Sint16 axisY = SDL_JoystickGetAxis(Joystick, 1);

for (int i = 0; i < 12; i++)
{
int btnid = Config::JoyMapping[i];
if (btnid < 0) continue;

bool pressed;
if (btnid == 0x101) // up
pressed = (hat & SDL_HAT_UP) || (axisY <= -16384);
else if (btnid == 0x104) // down
pressed = (hat & SDL_HAT_DOWN) || (axisY >= 16384);
else if (btnid == 0x102) // right
pressed = (hat & SDL_HAT_RIGHT) || (axisX >= 16384);
else if (btnid == 0x108) // left
pressed = (hat & SDL_HAT_LEFT) || (axisX <= -16384);
else
pressed = SDL_JoystickGetButton(Joystick, btnid);

if (pressed) joymask &= ~(1<<i);
}
}

blarg. joystick axis will only work if an actual dpad has been mapped


anyway, you can fix it by hand-editing the config file, like

Joy_Right=258
Joy_Left=264
Joy_Up=257
Joy_Down=260

let me know if that works

____________________
Kuribo64

thelittlejungler
Posted on 09-07-18 03:07 PM Link | #658
strange, now they seem to be well encoded but when i walk left i go up and when i go right i go down, but no output when i press up and down, i tried switching the codes but nothing happened, im going to try messing with the number codes and see where i get, but hey, its a step forward already, thanks.

Arisotura
Posted on 09-07-18 03:11 PM (rev. 2 of 09-07-18 03:12 PM) Link | #659
in the joystick property dialog, see if pressing the dpad directions yields the correct result

'cause otherwise that'd be weird. maybe it's returning values that fall below the thresholds melonDS uses. (the threshold value in the code above is 16384 which is 50% of the range in one direction)

____________________
Kuribo64

thelittlejungler
Posted on 09-07-18 03:18 PM Link | #660
i know right, it is wierd i press and they go where i want. OK, now for values, im seeing here on a program that the center of the axis is 32511 so, the double would be something like 65535 for right 0 for left ,65535 for down and 0 for up. im going to try to lower the range if i can and see what happens.

thelittlejungler
Posted on 09-11-18 06:47 PM Link | #665
i dont seem to be able to change the range.

Ammako
Posted on 09-21-18 08:26 PM Link | #670
Posted by StapleButter
anyway, you can fix it by hand-editing the config file, like

Joy_Right=258
Joy_Left=264
Joy_Up=257
Joy_Down=260

let me know if that works


Using a retail SFC pad with the Mayflash USB adapter here. I just wanted to say, that did it for me, thanks!


Main - Compatibility / Testing - D-Pads help Hide post layouts | New reply

Page rendered in 0.044 seconds. (2048KB of memory used)
MySQL - queries: 29, rows: 112/112, time: 0.015 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.