New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add and correct game-specific button names #237

Open
markwkidd opened this Issue May 25, 2018 · 29 comments

Comments

Projects
None yet
5 participants
@markwkidd
Collaborator

markwkidd commented May 25, 2018

If anyone fancies a try themselves, I have written up a doc with the process for adding driver-based button names: https://github.com/libretro/mame2003-plus-libretro/wiki/Submitting-Button-Names

It is pretty easy to add button names for a certain game or group of games, if I do say so myself. 🥇

Not that any of us needs to go about adding button names for all 4800 games! My goal for this functionality is only that if someone wants to add some button names it's easy for them to do so. Pending discovery of any unforeseen design flaws or bugs I think it's at that point.

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 25, 2018

@fr500 by the way I blame you for another 15 hours of my precious life spent on this core. Argh!!!

Maybe now I can at least get back to experimenting with the input device subtypes.

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 25, 2018

I hope this was a typo it should read this or use latest mame naming conventions

const char *sf2_btn_label(int input)
{
switch(input)
{
case IPT_BUTTON1:
return BTN1 "Weak punch";
case IPT_BUTTON2:
return BTN2 "medium punch";
case IPT_BUTTON3:
return BTN3 "Strong Punch";
case IPT_BUTTON4:
return BTN4 "Weak kick;
case IPT_BUTTON5:
return BTN5 "Medium kick";
case IPT_BUTTON6:
return BTN6 "Strong kick";
}
return generic_btn_label(input);
}

latest mame
/
CPS1 games with 2 players and 6 buttons each */
static INPUT_PORTS_START( cps1_6b)
PORT_INCLUDE( cps1_3b)

PORT_MODIFY("IN1")
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Jab Punch") PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Strong Punch") PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Fierce Punch") PORT_PLAYER(1)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P2 Jab Punch") PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Strong Punch") PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P2 Fierce Punch") PORT_PLAYER(2)

PORT_START("IN2")      /* Extra buttons */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P1 Short Kick") PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P1 Forward Kick") PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P1 Roundhouse Kick") PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("P2 Short Kick") PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("P2 Forward Kick") PORT_PLAYER(2)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P2 Roundhouse Kick") PORT_PLAYER(2)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )

our mame
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 ) //
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )

PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )

PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER1 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 | IPF_PLAYER1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 | IPF_PLAYER2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 | IPF_PLAYER2 )

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 25, 2018

ah haha shows how little I know street fighter 2. let me fix that.

Edit: I agree we should try to go with a standard, current MAME seems like the best standard

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 25, 2018

just a minor detail but will effect mapping just want to point out in code so im not coming across the wrong way mark

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 25, 2018

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 25, 2018

Well when its testing time give me a shout ill test with a ps3 and xbox360 controller assuming they both work in linux else ill just wait for the windows ra to compile as i dont habe a compile env setup for windows. Id rather test this in its native environment

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 25, 2018

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 25, 2018

what layout should i be choosing for a ps3 and 360 controller modern?

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 25, 2018

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 25, 2018

@markwkidd here is a good source of information for you

https://github.com/libretro/retroarch-joypad-autoconfig/tree/master/udev

im pretty sure this is my one

https://github.com/libretro/retroarch-joypad-autoconfig/blob/master/udev/DragonRise_Inc.___Generic___USB__Joystick__.cfg

for autoconfig to work for me i would need to rewire all my buttons. Right now i have them wired where mame expects 0 1 2 3 4 5 6 should be for mame so its just plug n play. Ill just edit the .cgf file probably the easiest way for me without rewiring

http://www.retroarch.com/index.php?page=joypad-autoconfig

just some generic information to help people along the way hopefully

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 25, 2018

im pretty sure i have a genesis type controller somewhere ill test how that works as well

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 25, 2018

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 26, 2018

@SapphireTactician I'm also tagging you because IIRC you were interested in this feature although I know you're indisposed for the foreseeable future. No need to reply.

edit: @grant2258 you can now download the current Windows build from the buildbot

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 26, 2018

@markwkidd this option should really be default option if no other option is used. Just hear me out a new user wet under the ears just wants to map any controller this is the place to do it. Any other user can just use one of the default maps provided! I would like to show some respect to @dankcushions and name this default and keep his fba modern with arcade panels that match up in auto config.

I know we had heated discussions about this all i wanted was a default mode where no buttons where re-mapped and you knew where they where for custom controls. arcade panels are very much a custom thing and having defaults to work from is all that is needed for us folk it should even make things easy to map for keyboard encoders. because button 1 is always where it should be ect

Sorry i fell asleep im on the painkillers for the back pain again

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 27, 2018

@robertvb83 you really inspired me with your comments about controls.dat on the retropie forums.

I am unfortunately busy for a few days but I wanted you to know that I think I'm about 80% through converting the .ini file to native c code that will fit into the button labeling system. I think! Consider all of this experimental, as usual :) I'm sure there are several more hours of work in store but I'm excited.

BTW that code doesn't quite compile yet and isn't being used yet but just so you know that your concept is viable here is the link: https://github.com/libretro/mame2003-plus-libretro/blob/master/src/controls.c

Safe travels!

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 27, 2018

what information do you need extracted mark i can try knock somthing up in mamemagic for the latest mame to grab the info and give you it in a macro friendly format of your choice just tell me what fields you need and how you want it displayed for the macro

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 27, 2018

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 27, 2018

look like mame isint spitting that detail out by default doest mean we can convince too. Keep this for now but ill look into getting latest mame to dump that info in case you might want to update it it just a little extra code if its setup like mame2003

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 27, 2018

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 27, 2018

yea i can see its all in the drivers now which is nice

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented May 27, 2018

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 27, 2018

well that might be possible would need to parse every driver file though that would be seperte from mamemagic but python is a great tool for stuff like that might even to be able to grep it all out!

@grant2258

This comment has been minimized.

Contributor

grant2258 commented May 27, 2018

well it is gradable if you go through every file formats like this.

static INPUT_PORTS_START( 1942 )
PORT_START("SYSTEM")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

PORT_START("P1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )

PORT_START("P2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )

PORT_START("DSWA")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )       PORT_DIPLOCATION("SWA:8,7,6")
PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
PORT_DIPSETTING(    0x05, DEF_STR( 1C_4C ) )
PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("SWA:5")
PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) )   PORT_DIPLOCATION("SWA:4,3")
PORT_DIPSETTING(    0x30, "20K 80K 80K+" )
PORT_DIPSETTING(    0x20, "20K 100K 100K+" )
PORT_DIPSETTING(    0x10, "30K 80K 80K+" )
PORT_DIPSETTING(    0x00, "30K 100K 100K+" )
PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Lives ) )        PORT_DIPLOCATION("SWA:2,1")
PORT_DIPSETTING(    0x80, "1" )
PORT_DIPSETTING(    0x40, "2" )
PORT_DIPSETTING(    0xc0, "3" )
PORT_DIPSETTING(    0x00, "5" )

PORT_START("DSWB")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) )       PORT_DIPLOCATION("SWB:8,7,6")
PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
PORT_DIPSETTING(    0x05, DEF_STR( 1C_4C ) )
PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
PORT_SERVICE_DIPLOC(0x08, IP_ACTIVE_LOW, "SWB:5" )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) )  PORT_DIPLOCATION("SWB:4")
PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
PORT_DIPSETTING(    0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SWB:3,2")
PORT_DIPSETTING(    0x40, DEF_STR( Easy ) )
PORT_DIPSETTING(    0x60, DEF_STR( Normal ) )
PORT_DIPSETTING(    0x20, DEF_STR( Difficult ) )
PORT_DIPSETTING(    0x00, DEF_STR( Very_Difficult ) )
PORT_DIPNAME( 0x80, 0x80, "Screen Stop" )           PORT_DIPLOCATION("SWB:1")
PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
PORT_DIPSETTING(    0x00, DEF_STR( On ) )

INPUT_PORTS_END

see how we go with what we have im sure itll all be covered if we need to find a way to grab it im sure we can find a way

@markwkidd markwkidd changed the title from New doc: Adding driver-based button names to WIP Adding driver-based button names - with new docs! May 29, 2018

@gomisensei

This comment has been minimized.

gomisensei commented Jun 1, 2018

is any of this functionality working yet, or is there an option i need to set to see it?

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented Jun 1, 2018

Right now there are driver-specific button labels for Neo Geo, Street Fighter 2 (and its clones), and the two "Stone Ball" clones.

If you do any coding: Other controller names can be added from the existing control.dat information in control.c or created from scratch. Both options are described in some detail in the wiki: https://github.com/libretro/mame2003-plus-libretro/wiki/Submitting-Button-Names

@robertvb83

This comment has been minimized.

Contributor

robertvb83 commented Oct 20, 2018

@markwkidd @grant2258 the wiki now is a little bit outdated but with recent changes i think it will be even easier and i know how to contribute new button names.
Do you plan to transfer the per game control value inside controls.c into all the drivers automatically? Or should this be done manually? I just like to know before starting with anything that might not be needed

@markwkidd markwkidd changed the title from WIP Adding driver-based button names - with new docs! to Adding driver-based button names - with new docs! Oct 20, 2018

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented Oct 20, 2018

@arcadez is input port tagging the same code that it would take to add these button names to the drivers internally (as opposed to the current controls.c approach), or is my guess wrong?

@markwkidd

This comment has been minimized.

Collaborator

markwkidd commented Oct 20, 2018

@robertvb83 I have updated the button naming wiki page -- hopefully it's correct now.

@arcadez

This comment has been minimized.

Collaborator

arcadez commented Oct 20, 2018

@markwkidd TBH i haven't really been paying much attention to these input changes so im not
best placed to answer.

@markwkidd markwkidd changed the title from Adding driver-based button names - with new docs! to How to add and correct game-specific button names Oct 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment