libretro / mame2003-plus-libretro

Updated 2018 version of MAME (0.78) for libretro. with added game support plus many fixes and improvements
Other
190 stars 109 forks source link

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

Open markwkidd opened 6 years ago

markwkidd commented 6 years ago

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. :1st_place_medal:

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 commented 6 years ago

@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.

ghost commented 6 years ago

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 commented 6 years ago

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

ghost commented 6 years ago

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 commented 6 years ago

Not at all. I have just been using example code radius shared but they even said themselves that it was just a concept. I forgot to ever make sure what the button names really are on that!

BTW I did make sure that Neo Geo A, B, C, and D are mapped right hehe

On Fri, May 25, 2018 at 5:12 PM, grant2258 notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libretro/mame2003-plus-libretro/issues/237#issuecomment-392200708, or mute the thread https://github.com/notifications/unsubscribe-auth/ASphditcnUEOZ9A4Ibyx9Ol1KQODwX2Zks5t2IG7gaJpZM4UOmGr .

-- Mark W. Kidd http://facebook.com/markwkidd (606)536-0115

ghost commented 6 years ago

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 commented 6 years ago

I'm hoping that it's ready for testing now, and unless someone notices another issue I'll not be making any commits. Hopefully the buildbot will get a new nightly core up on the web soon! :)

On Fri, May 25, 2018 at 5:21 PM, grant2258 notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libretro/mame2003-plus-libretro/issues/237#issuecomment-392202313, or mute the thread https://github.com/notifications/unsubscribe-auth/ASphdoDXK85wSb7wAhgWRtIUSGJDvTFaks5t2IPjgaJpZM4UOmGr .

-- Mark W. Kidd http://facebook.com/markwkidd (606)536-0115

ghost commented 6 years ago

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

markwkidd commented 6 years ago

As far as I know yes Modern unless you explicitly have something that uses SNES-style control arrangements like my SNES controllers.

I don't own any controllers newer than SNES but I really should buy at least one.

On Fri, May 25, 2018 at 5:26 PM, grant2258 notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libretro/mame2003-plus-libretro/issues/237#issuecomment-392203233, or mute the thread https://github.com/notifications/unsubscribe-auth/ASphdmeGR6SAv8-kHV63AzHskZ0WIoCCks5t2IUvgaJpZM4UOmGr .

-- Mark W. Kidd http://facebook.com/markwkidd (606)536-0115

ghost commented 6 years ago

@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

ghost commented 6 years ago

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

markwkidd commented 6 years ago

Grant FYI I have kept a copy of your 10-button arcade layout retropad layout that you posted a few days back.

I am very glad to add that even now with the "core option" version of the retropad controller layouts, so we can get it in before I get back into trying to implement the retropad subtyps

I'll let the buildbot make it through a complete round of mame2003-plus first but later today or tomorrow I'll slot in the 10-button layout and tag you

On Fri, May 25, 2018 at 5:40 PM, grant2258 notifications@github.com wrote:

@markwkidd https://github.com/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.GenericUSBJoystick.cfg

for autoconfig to work for me i would need to rewire all my buttons. Right now i have them wired where mame expect 0 1 2 3 4 5 6 should be for mame so its just plug n play.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libretro/mame2003-plus-libretro/issues/237#issuecomment-392205393, or mute the thread https://github.com/notifications/unsubscribe-auth/ASphdleo0ww4co0g8daHgxOzqlK0vZZPks5t2IhFgaJpZM4UOmGr .

-- Mark W. Kidd http://facebook.com/markwkidd (606)536-0115

markwkidd commented 6 years ago

@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

ghost commented 6 years ago

@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 commented 6 years ago

@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!

ghost commented 6 years ago

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 commented 6 years ago

I love the sound of that grant. I am trying to create a standardized format for us to use. I just pushed a new commit so you can have everything that I have been able to extract from the controls.dat project, for your reference.

The most important information is all there in controls.c however -- if you can extract data from current MAME and put it into that format then it should be readable by mame2003-plus. The only things in controls.c that I haven't finished porting are the names for some of the analog control types. It really is 80% done though, I think you can read controls.c and understand how it works even in its current incomplete state.

On Sun, May 27, 2018 at 1:55 PM, grant2258 notifications@github.com wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libretro/mame2003-plus-libretro/issues/237#issuecomment-392355250, or mute the thread https://github.com/notifications/unsubscribe-auth/ASphdtdfYUKvCviseC0mneSqJs7Co6Ioks5t2vaugaJpZM4UOmGr .

-- Mark W. Kidd http://facebook.com/markwkidd (606)536-0115

ghost commented 6 years ago

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 commented 6 years ago

there were apparently big changes to mame controller information after 0.141 which is part of why the controls.dat project ended at that version. it may be we need to use controls.dat as our primary reference and then current MAME sourcecode when controls.dat isn't available or reliable

On Sun, May 27, 2018 at 2:16 PM, grant2258 notifications@github.com wrote:

look like mame isint spitting that detaail out by deafault 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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libretro/mame2003-plus-libretro/issues/237#issuecomment-392358671, or mute the thread https://github.com/notifications/unsubscribe-auth/ASphdpLQha06c7TFB_AOgfFkDf1l6zQ5ks5t2vuOgaJpZM4UOmGr .

-- Mark W. Kidd http://facebook.com/markwkidd (606)536-0115

ghost commented 6 years ago

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

markwkidd commented 6 years ago

I only looked a little at trying to backport the current MAME strings to ours in an automated way but it seemed impossible at the time. controls.dat is much more similar to ours -- admittedly it has taken several hours to get to this point but controls.dat is much closer to what we have from the MAME 0.78 input system so it has been a straightforward process.

I know you have spent more time working your mamemagic recently so you might be able to find a way to pull it out of current MAME drivers that didn't occur to me :D

On Sun, May 27, 2018 at 2:29 PM, grant2258 notifications@github.com wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libretro/mame2003-plus-libretro/issues/237#issuecomment-392360212, or mute the thread https://github.com/notifications/unsubscribe-auth/ASphdmN1-EK_BGV2cf9TD7xCrZSVhu2_ks5t2v6TgaJpZM4UOmGr .

-- Mark W. Kidd http://facebook.com/markwkidd (606)536-0115

ghost commented 6 years ago

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!

ghost commented 6 years ago

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

gomisensei commented 6 years ago

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

markwkidd commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

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

ghost commented 6 years ago

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