Jump to content

All my products and services are free. All my costs are met by donations I receive from my users. If you enjoy using any of my products, please donate to support me. Thank you for your support. Tom Speirs

Patreon

[RESOLVED] mame, binding keyboard keys to gamepad.


Bringamosa

Recommended Posts

Hi all,

I hope i'm in the right section here. I have some trouble with mapping some keys to my gamepad.

First of all, i got it all working in GameEx. So i can use my gamepad to control the menu. (joystick for scrolling, buttons to select, go back etc)

I use Xpadder to get this all done.

Now my problem is, whenever is start MAME, i NEED to use my keyboard for input 1 (player one) and input 5 (insert coin)

I have mapped 2 buttons on my gamepad to kb1 and kb5. These do work, if i open wordpad and hit the buttons the numbers 1 and 5 do appear. But somehow it does not work in MAME. So i still have to use my keyboard and hit the 1 and 5 on there in order to get player one selected and insert coins.

Anybody had this problem and solved it? Or anybody got some idea's how tyo solve this problem?

Link to comment
Share on other sites

You need to compile mame yourself to accept direct input. Headkaze's MAME Compiler 64 offers this functionality. You'll have to do a Google search for it, I'm in tapatalk and don't have a link in front of me.

Link to comment
Share on other sites

You can switch between raw and di? Since when?

Xpadder only works in DI, so that's the issue here I think, unless I misread.

Link to comment
Share on other sites

You should be able to configure it within Mame itself.

I tried that. I changed 1 (player one) and 5 (insert coin) to [ and ]

Now, this works, if i use [ and ] on my keyboard, it works in MAME. Now i changed the mapping on my gamepad to imput [ and ] too. Now here is the weird thing, it still does nt work.

I tried diffrent buttons on my gamepad. All the other buttons are working, so the Ctrl, Alt, Spacebar and Shift doe work on my gamepad. Only ones that will not work are 1 and 5 (after i changed them [ and ] but changed that back)

So, i have to use my keyboard for 1 and 5, and after that i can just play the games with my gamepad. If i want more coins i need to use my keayboard again.

Link to comment
Share on other sites

You can, but he said he's using xpadder.

If you add the -joy cl switch to mame, you can configure the joystick too, but he said he was using Xpadder and trying to map key strokes to the joystick. In which case, he needs DI. :-)

I think what's going on here is your mapping keys to the joy stick in MAME but trying to set key strokes in the ui. In many cases MAME will have a default joystick mapping for any connected game pads, but not for those buttons. If you edit the input and press the button you want to use on the joystick instead of the keyboard, you can eliminate Xpadder altogether, which is what Tempest is suggesting.

Link to comment
Share on other sites

Well, working on compiling mame, more about that later.

I also tried that, start a game, hit TAB and then configure the controls. Go to "start" and i see kb1and kb5 is configured there. i hit enter and then it goes blank, press the button i want to use on my gamepad, and i see it changes to that button. so i go down all the way, back to prior menu, back to game, give it a try and it wont work. Double checked by hitting TAB again, input is still ghanged. (Also tried diffrent buttons on my gamepad so i'm sure it's not a malfunction of a particular button)

This all without using Xpadder btw.

For me the weird thing is that any button works with any input, but just the 1 and 5 dont :(

Link to comment
Share on other sites

Well my setup is a hybrid of both Xpadder and the MAME settings. I use regular joystick inputs for these buttons, and mine is working without Xpadder, so I can assure you this works without any extra settings.

A couple of thoughts here: is your MAME.ini set to read only? Immediately after mapping and it says it's mapped, enter the tab menu and look again. Are they still correctly mapped? If so, do they work? Or are your settings not being applied when you exit the game and reenter it?

This sounds more and more like a problem with MAME itself, in which case I owe you an apology, Tempest. My bad. :-)

Link to comment
Share on other sites

Thanks for the super fast replies.

It does not give me a message that something is changed.

I do see the input change from kbd5 to joy-button1 (or whatever button i take on my gamepad). After that i go back to the game, and i can not use the button to add coins. Then i go back there with tab again and it is still changed to my gamepad button. I also tried quitting the game and start it up again, try my button and it still does not work, hit tab and have a look and the button is still assigned there.

Weird thing is, the kb5 still does work, even when in mame its assigned to my gamepad button.

Maybe you can have a look at my ini file?

## NAVIGATION KEY CODES#ui_key_up                 KEYCODE_UPui_key_down               KEYCODE_DOWNui_key_left               KEYCODE_LEFTui_key_right              KEYCODE_RIGHTui_key_start              "KEYCODE_ENTER NOT KEYCODE_LALT"ui_key_pgup               KEYCODE_PGUPui_key_pgdwn              KEYCODE_PGDNui_key_home               KEYCODE_HOMEui_key_end                KEYCODE_ENDui_key_ss_change          KEYCODE_INSERTui_key_history_up         KEYCODE_DELui_key_history_down       "KEYCODE_LALT KEYCODE_0"ui_key_context_filters    "KEYCODE_LCONTROL KEYCODE_F"ui_key_select_random      "KEYCODE_LCONTROL KEYCODE_R"ui_key_game_audit         "KEYCODE_LALT KEYCODE_A"ui_key_game_properties    "KEYCODE_LALT KEYCODE_ENTER"ui_key_help_contents      KEYCODE_F1ui_key_update_gamelist    KEYCODE_F5ui_key_view_folders       "KEYCODE_LALT KEYCODE_D"ui_key_view_fullscreen    KEYCODE_F11ui_key_view_pagetab       "KEYCODE_LALT KEYCODE_B"ui_key_view_picture_area  "KEYCODE_LALT KEYCODE_P"ui_key_view_status        "KEYCODE_LALT KEYCODE_S"ui_key_view_toolbars      "KEYCODE_LALT KEYCODE_T"ui_key_view_tab_cabinet   "KEYCODE_LALT KEYCODE_3"ui_key_view_tab_cpanel    "KEYCODE_LALT KEYCODE_6"ui_key_view_tab_flyer     "KEYCODE_LALT KEYCODE_2"ui_key_view_tab_history   "KEYCODE_LALT KEYCODE_8"ui_key_view_tab_marquee   "KEYCODE_LALT KEYCODE_4"ui_key_view_tab_screenshot "KEYCODE_LALT KEYCODE_1"ui_key_view_tab_title     "KEYCODE_LALT KEYCODE_5"ui_key_view_tab_pcb       "KEYCODE_LALT KEYCODE_7"ui_key_quit               "KEYCODE_LALT KEYCODE_Q"## NAVIGATION JOYSTICK CODES#ui_joy_up                 1,1,1,1ui_joy_down               1,1,1,2ui_joy_left               1,1,2,1ui_joy_right              1,1,2,2ui_joy_start              1,0,1,0ui_joy_pgup               2,1,2,1ui_joy_pgdwn              2,1,2,2ui_joy_home               0,0,0,0ui_joy_end                0,0,0,0ui_joy_ss_change          2,0,3,0ui_joy_history_up         2,0,4,0ui_joy_history_down       2,0,1,0ui_joy_exec               0,0,0,0

Looks like i can not find kb1 and kb5 there.

Link to comment
Share on other sites

Found it in the ini folder.

Mame ini:

<UNADORNED0>              ## CORE CONFIGURATION OPTIONS#readconfig                1## CORE SEARCH PATH OPTIONS#rompath                   romssamplepath                samplesartpath                   artworkctrlrpath                 ctrlrinipath                   inifontpath                  .## CORE OUTPUT DIRECTORY OPTIONS#cfg_directory             cfgnvram_directory           nvrammemcard_directory         memcardinput_directory           inpstate_directory           stasnapshot_directory        snapdiff_directory            diffcomment_directory         comments## CORE FILENAME OPTIONS#cheat_file                cheat.dat## CORE STATE/PLAYBACK OPTIONS#state                     autosave                  0playback                  record                    mngwrite                  wavwrite                  ## CORE PERFORMANCE OPTIONS#autoframeskip             0frameskip                 0seconds_to_run            0throttle                  1sleep                     1speed                     1.0refreshspeed              0## CORE ROTATION OPTIONS#rotate                    1ror                       0rol                       0autoror                   0autorol                   0flipx                     0flipy                     0## CORE ARTWORK OPTIONS#artwork_crop              0use_backdrops             1use_overlays              1use_bezels                1## CORE SCREEN OPTIONS#brightness                1.0contrast                  1.0gamma                     1.0pause_brightness          0.65## CORE VECTOR OPTIONS#antialias                 1beam                      1.0flicker                   0## CORE SOUND OPTIONS#sound                     1samplerate                48000samples                   1volume                    0## CORE INPUT OPTIONS#ctrlr                     mouse                     0joystick                  1lightgun                  0multikeyboard             0multimouse                0steadykey                 0offscreen_reload          0joystick_map              autojoystick_deadzone         0.3joystick_saturation       0.85## CORE INPUT AUTOMATIC ENABLE OPTIONS#paddle_device             keyboardadstick_device            keyboardpedal_device              keyboarddial_device               keyboardtrackball_device          keyboardlightgun_device           keyboardpositional_device         keyboardmouse_device              mouse## CORE DEBUGGING OPTIONS#log                       0verbose                   0update_in_pause           0## CORE MISC OPTIONS#bios                      defaultcheat                     0skip_gameinfo             0## WINDOWS DEBUGGING OPTIONS#oslog                     0## WINDOWS PERFORMANCE OPTIONS#priority                  0multithreading            0## WINDOWS VIDEO OPTIONS#video                     d3dnumscreens                1window                    0maximize                  1keepaspect                1prescale                  1effect                    nonewaitvsync                 0syncrefresh               0## DIRECTDRAW-SPECIFIC OPTIONS#hwstretch                 1## DIRECT3D-SPECIFIC OPTIONS#d3dversion                9filter                    1## PER-WINDOW VIDEO OPTIONS#aspect                    autoresolution                autoscreen0                   autoaspect0                   autoresolution0               autoview0                     autoscreen1                   autoaspect1                   autoresolution1               autoview1                     autoscreen2                   autoaspect2                   autoresolution2               autoview2                     autoscreen3                   autoaspect3                   autoresolution3               autoview3                     auto## FULL SCREEN OPTIONS#triplebuffer              0switchres                 0full_screen_brightness    1.0full_screen_contrast      1.0full_screen_gamma         1.0## WINDOWS SOUND OPTIONS#audio_latency             2## INPUT DEVICE OPTIONS#dual_lightgun             0

Mame32 ini:

# <UNADORNED0>            <NULL> (not set)## CORE SEARCH PATH OPTIONS#rompath                   romssamplepath                samplesartpath                   artworkctrlrpath                 ctrlrinipath                   inifontpath                  .## CORE OUTPUT DIRECTORY OPTIONS#cfg_directory             cfgnvram_directory           nvrammemcard_directory         memcardinput_directory           inpstate_directory           stasnapshot_directory        snapdiff_directory            diffcomment_directory         comments## CORE FILENAME OPTIONS#cheat_file                cheat.dat## CORE STATE/PLAYBACK OPTIONS## state                   <NULL> (not set)autosave                  0# playback                <NULL> (not set)# record                  <NULL> (not set)# mngwrite                <NULL> (not set)# wavwrite                <NULL> (not set)## CORE PERFORMANCE OPTIONS#autoframeskip             0frameskip                 0seconds_to_run            0throttle                  1sleep                     1## CORE ROTATION OPTIONS#rotate                    1ror                       0rol                       0autoror                   0autorol                   0flipx                     0flipy                     0## CORE ARTWORK OPTIONS#artwork_crop              0use_backdrops             1use_overlays              1use_bezels                1## CORE SCREEN OPTIONS#brightness                1.0contrast                  1.0gamma                     1.0pause_brightness          0.650000## CORE VECTOR OPTIONS#antialias                 1beam                      1.0flicker                   0## CORE SOUND OPTIONS#sound                     1samplerate                48000samples                   1volume                    0## CORE INPUT OPTIONS#ctrlr                     ## CORE DEBUGGING OPTIONS#log                       0verbose                   0## CORE MISC OPTIONS#bios                      nonecheat                     0skip_gameinfo             0## DEBUGGING OPTIONS#oslog                     0## WINDOWS PERFORMANCE OPTIONS#priority                  0multithreading            0## WINDOWS VIDEO OPTIONS#video                     d3dnumscreens                1window                    0maximize                  1keepaspect                1prescale                  1effect                    nonewaitvsync                 0syncrefresh               0## DIRECTDRAW-SPECIFIC OPTIONS#hwstretch                 1## DIRECT3D-SPECIFIC OPTIONS#d3dversion                9filter                    1## PER-WINDOW VIDEO OPTIONS#aspect                    autoresolution                autoscreen0                   autoaspect0                   autoresolution0               autoview0                     autoscreen1                   autoaspect1                   autoresolution1               autoview1                     autoscreen2                   autoaspect2                   autoresolution2               autoview2                     autoscreen3                   autoaspect3                   autoresolution3               autoview3                     auto## FULL SCREEN OPTIONS#triplebuffer              0switchres                 0full_screen_brightness    1.0full_screen_contrast      1.0full_screen_gamma         1.0## WINDOWS SOUND OPTIONS#audio_latency             1## INPUT DEVICE OPTIONS#mouse                     1joystick                  0lightgun                  0dual_lightgun             0offscreen_reload          0steadykey                 1joy_deadzone              0.3joy_saturation            0.85digital                   none## AUTOMATIC DEVICE SELECTION OPTIONS#paddle_device             keyboardadstick_device            keyboardpedal_device              keyboarddial_device               keyboardtrackball_device          keyboardlightgun_device           keyboardpositional_device         keyboard

Btw, this is the mame i'm messing around with to try to get it to work.

For GameEx i got mame64 but can not find a mame.ini file there....

Link to comment
Share on other sites

Can't stand it when i can't solve a problem. So, no sleep.

Problem partially solved. I got 1 and 5 working on my gamepad. BUT....... i can nog change it in "input (general)" but have to change it in "input (this game)" wich means i have to manualy change this to all the games? :o

I'm allmost sure there is a workaround or some neat trick for this.

And now real bedtime

Link to comment
Share on other sites

I made a mistake when I said post your mame.ini. I should have said post your Mame\cfg\default.cfg. That is the file that would indicate your key bindings in general. When you create settings per game, mame creates a file for each game that has per game settings in the cfg folder.If you changed Pacman, there would be a mame\cfg\pacman.cfg file. The fact that you can set keys per game but not globally would indicate to me that either your default.cfg is write protected, or there is a permission issue.

Link to comment
Share on other sites

Allrighty, default.cfg

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
<system name="default">
<input>
<port type="P1_BUTTON5">
<newseq type="standard">
KEYCODE_Z
</newseq>
</port>
<port type="P1_BUTTON6">
<newseq type="standard">
KEYCODE_X
</newseq>
</port>
<port type="P1_START">
<newseq type="standard">
JOYCODE_1_BUTTON10
</newseq>
</port>
<port type="P1_SELECT">
<newseq type="standard">
JOYCODE_1_BUTTON9
</newseq>
</port>
</input>
</system>
</mameconfig>

And then 1944

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
<system name="1944">
<counters>
<coins index="0" number="7" />
</counters>
<input>
<port tag=":IN2" type="START1" mask="256" defvalue="256">
<newseq type="standard">
JOYCODE_1_BUTTON5
</newseq>
</port>
<port tag=":IN2" type="COIN1" mask="4096" defvalue="4096">
<newseq type="standard">
JOYCODE_1_BUTTON6
</newseq>
</port>
</input>
</system>
</mameconfig>

Off to work now so will have a look myself too when i get home.
Link to comment
Share on other sites

Allright, problem solved. Sad part is no idea HOW.

Yesterday i compiled mame64 myself like Adultery sugested with DI and it's working! So so far so good.

Once again thank you guys for thinking with me. I'm surprised with the quick responses and goodwill to help others. (Time to register my GameEx and help the developers too)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...