djdron / UnrealSpeccyP

Portable ZX-Spectrum emulator supports Z80 128K (Pentagon) AY/YM, Beeper, Beta Disk, Tape, Kempston Joystick/Mouse, Snapshots, Replays.
https://bitbucket.org/djdron/unrealspeccyp
Other
64 stars 14 forks source link

Map B gamepad button to UP #3

Closed morozov closed 4 years ago

morozov commented 5 years ago

Usually, the B button is used as "jump" however it currently acts as "fire". Jumping with the "up" on the vertical axis is not really convenient.

djdron commented 5 years ago

Hi! 'e' is not 'B' button. It's 'ENTER' on keyboard.

morozov commented 5 years ago

True. With this change, the B button worked as "up" but the Enter key stopped working. I only figured that out after submitting the pull request.

In any event, the issue still stays. I solved it temporarily for myself as:

diff --git a/platform/sdl2/sdl2_joystick.cpp b/platform/sdl2/sdl2_joystick.cpp
index c715c94..74154f8 100644
--- a/platform/sdl2/sdl2_joystick.cpp
+++ b/platform/sdl2/sdl2_joystick.cpp
@@ -124,7 +124,7 @@ void ProcessJoy(SDL_Event& e)
    ProcessButton(PB_LEFT, pad, pad_prev, 'l');
    ProcessButton(PB_RIGHT, pad, pad_prev, 'r');
    ProcessButton(PB_A, pad, pad_prev, 'f');
-   ProcessButton(PB_B, pad, pad_prev, 'e');
+   ProcessButton(PB_B, pad, pad_prev, 'u');
    ProcessButton(PB_X, pad, pad_prev, '1');
    ProcessButton(PB_Y, pad, pad_prev, ' ');
    ProcessButton(PB_SELECT, pad, pad_prev, 'm');

Could you suggest a valid approach of doing that? I couldn't find any place in the code which would describe all the meanings of 'e', '1', etc.

djdron commented 5 years ago

You can find all keys here in key_map array. Also 'l', 'r', 'u', 'd', 'f' - mapped to current selected joystick buttons.

morozov commented 4 years ago

You can find all keys here in key_map array. Also 'l', 'r', 'u', 'd', 'f' - mapped to current selected joystick buttons.

So, this way, mapping PB_B to u (which is "up" on the joystick) looks like the right thing to do. A is fire, B is up. Doesn't it?

djdron commented 4 years ago

Hi!) May be better will be map X button to "up" instead of this ? ProcessButton(PB_X, pad, pad_prev, '1');

morozov commented 4 years ago

May be better will be map X button to "up" instead of this?

Why? In most games I played on NES, A is "fire", B is "jump". On Sega, usually B or C is "jump". What is special about Enter that it needs to be mapped to B?

On the other hand, I have never used X, Y and Z on any console. In my experience, they may have the same meaning as A, B and C respectively but on repeat.

I'm not trying to push my patch. Really trying to understand the motivation behind the current layout.

djdron commented 4 years ago

May be better will be map X button to "up" instead of this?

Why? In most games I played on NES, A is "fire", B is "jump". On Sega, usually B or C is "jump". What is special about Enter that it needs to be mapped to B?

I mean to leave ENTER on some button. May be on X instead of "1". Because you removed ENTER (changed to "up").

djdron commented 4 years ago

I'm not trying to push my patch. Really trying to understand the motivation behind the current layout.

It was mapped for Dingoo A320. "1" (X) was mapped for Max Petrov boot from MadROM. But now it's not used because of auto-launch implemented.

morozov commented 4 years ago

I mean to leave ENTER on some button. May be on X instead of "1".

Ah, gotcha! To me, I would expect Enter to be mapped to something like PB_SELECT or PB_START which are currently mapped to m and k. What do those symbols mean?

djdron commented 4 years ago

I mean to leave ENTER on some button. May be on X instead of "1".

Ah, gotcha! To me, I would expect Enter to be mapped to something like PB_SELECT or PB_START which are currently mapped to m and k. What do those symbols mean?

'm' means menu, 'k' means virtual keyboard

morozov commented 4 years ago

Done. Please see the update.