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. My bare hosting costs are currently not met so please consider donating by either clicking this text or the Patreon link on the right.

Patreon

Recommended Posts

Posted

I've got Gx and MAME all nicely working in a vertical format for my upcoming cocktail cabinet.

I've trimmed my thousands of ROMs down to several hundred vertical only, using a script I found somewhere.

However the one thing I can't seem to figure out is if there is a way (command line, 3rd party app, etc) that can automatically search/set the DIP Switch settings for each ROM, and if the "Cabinet" entry exists, flip it from the default of "Upright" to "Cocktail".

Anyone? Anyone?

Bueller?

Posted

Try running

mame.exe -showusage

This spits out a bunch of stuff so I usually redirect the output to a file. Anyway, there is a section in there about rotation options:

#
# CORE ROTATION OPTIONS
#
-rotate rotate the game screen according to the game's orientation needs it
-ror rotate screen clockwise 90 degrees
-rol rotate screen counterclockwise 90 degrees
-autoror automatically rotate screen clockwise 90 degrees if vertical
-autorol automatically rotate screen counterclockwise 90 degrees if vertical
-flipx flip screen left-right
-flipy flip screen upside-down

Posted

Thanks BK, but that's for screen rotation, which I have all set. The DIP switch setting controls (typically) how the game operates. If it is set to "cocktail" then when it is player 2's turn, the game flips the screen automatically.

I'll give it a shot but I don't think that'll do the trick.

Posted

I could write a script to generate the cfgs with that setting. It would be easier if you don't have any existing cfgs with information in them that you want to retain. Let me know where you are, and where your going...

It looks like 829 cfgs with out clones. 1982 cfgs with clones.

Posted
I could write a script to generate the cfgs with that setting. It would be easier if you don't have any existing cfgs with information in them that you want to retain. Let me know where you are, and where your going...

It looks like 829 cfgs with out clones. 1982 cfgs with clones.

Wow? Really? That'd be awesome, thanks! If it is going to be anything more than a few moments of your time, please do not trouble yourself. I can always use slave labor: aka my 9 year old ;)

My current CFGs are pretty much just me 1 by 1 flipping the virtual DIP ;) So they are sacrificial.

I have 842 ROMs in my folder...some are clones.

Let me know how I can help.

Posted

I'm a liar.

Look at these two cfgs:

005.cfg

<?xml version="1.0"?>

<mameconfig version="10">

<system name="005">

<input>

port tag="D3D2" type="DIPSWITCH" mask="4" defvalue="4" value="0" />

</input>

</system>

</mameconfig>

10yard.cfg

<?xml version="1.0"?>

<mameconfig version="10">

<system name="10yard">

<input>

port tag="DSW2" type="DIPSWITCH" mask="2" defvalue="0" value="2" />

</input>

</system>

</mameconfig>

See how the lines in red are different? I don't know how Mame calculates this, so the only way I know to get the correct information, is to run each game in Mame. I am almost certain that the cfgs won't work without that info. I wrote a program (Don't get confused, I know that you didn't ask about that) that allows you to create custom cfg files, but right now it only deals with Player Input. I think that the cocktail option would be a nice addition to CFG Magician. If you are patient, I will work on it. I have a script that runs Mame, and enters the necessary information in the Tab Menu in Mame. It does the same thing that you would have to do by hand, but uses an automated process... If for some reason I can't do it automatically, I will let you know.

On the other hand, if you want to have your 9 year old run the 1982 games, and then upload the cfgs so I can use them, that would be fine too! :P

Posted

I did a little more investigation...

10yard.cfg

<?xml version="1.0"?>

<!-- This file is autogenerated; comments and unknown tags will be stripped -->

<mameconfig version="10">

<system name="10yard">

<input>

<port tag="DSW2" type="DIPSWITCH" mask="1" defvalue="1" value="0" />

<port tag="DSW2" type="DIPSWITCH" mask="2" defvalue="0" value="2" />

<port tag="DSW2" type="DIPSWITCH" mask="4" defvalue="4" value="0" />

<port tag="DSW2" type="DIPSWITCH" mask="8" defvalue="8" value="0" />

<port tag="DSW2" type="DIPSWITCH" mask="16" defvalue="16" value="0" />

<port tag="DSW2" type="DIPSWITCH" mask="32" defvalue="32" value="0" />

<port tag="DSW2" type="DIPSWITCH" mask="64" defvalue="64" value="0" />

<port tag="DSW2" type="DIPSWITCH" mask="128" defvalue="128" value="0" />

<port tag="DSW1" type="DIPSWITCH" mask="1" defvalue="1" value="0" />

<port tag="DSW1" type="DIPSWITCH" mask="2" defvalue="2" value="0" />

<port tag="DSW1" type="DIPSWITCH" mask="12" defvalue="12" value="0" />

<port tag="DSW1" type="DIPSWITCH" mask="48" defvalue="48" value="0" />

<port tag="DSW1" type="DIPSWITCH" mask="192" defvalue="192" value="0" />

</input>

</system>

</mameconfig>

I changed all of the default dip switch settings, which is what I would have to do if I used a script. As you can tell, there would be know way of knowing which line that we would need, to change the cabinet setting... Sorry, but I can't help you. :(

If you really do have your 9 year old do this, I would like to have a copy of the cfg files, then in the future, people would be able to use CFG Magician to accomplish this task.

Posted

There may be information in the bios for each game to figure this out. However, the time it would take to review the source for each bios (which covers multiple games) would be much greater than just loading each game and going through the TAB menu. Sorry, I don't know of an easy way to do this without having a list of what the dip switches do for every game.

Posted
There may be information in the bios for each game to figure this out. However, the time it would take to review the source for each bios (which covers multiple games) would be much greater than just loading each game and going through the TAB menu. Sorry, I don't know of an easy way to do this without having a list of what the dip switches do for every game.

There is no other way to do this. I posted this same question a few years ago on the MAME Dev forum when I was building my daughters Cafe style cabinet. You have to run each game and set it individually because it's part of the game ROM instructions, and not a scripting thing. It's hard-coded into the ROM.

IMBerzerk

Posted

Is the menu structure always the same in MAME? If so, then you could still script this by using an older version of MAME that accepts script input (pre-0.117) or compiling a version of MAME that doesn't use the RAW system. If the menus are always the same, then you could go through the list and switch modes automatically. My guess is that things aren't consistent, but you never know.

If you do want to use a script, you might want to use skip startup frames to make things quicker. On the other hand, as soon as the rom is loaded, you can go to the TAB menu anyway, so I guess you probably don't need that.

Posted
Is the menu structure always the same in MAME? If so, then you could still script this by using an older version of MAME that accepts script input (pre-0.117) or compiling a version of MAME that doesn't use the RAW system. If the menus are always the same, then you could go through the list and switch modes automatically. My guess is that things aren't consistent, but you never know.

If you do want to use a script, you might want to use skip startup frames to make things quicker. On the other hand, as soon as the rom is loaded, you can go to the TAB menu anyway, so I guess you probably don't need that.

I had thought about that too originally. If there was some way to simple position yourself with the menu in the item that says "Cabinet" (should it exist), and then move the options until "cocktail" was detected, you'd be golden.

Executing this though, is beyond my current skill set.

Anyway, it seems to me the text is the same when used (it comes out of MAME itself I believe), but the position within the menu, and how many menu items there are, varies with each game.

Posted

Right, I don't know of any way to detect what menu options are displayed, so the only thing you could do is send keys that move the selection down a certain number, send select, send the selection down, etc... Since I was pretty sure, and as you've confirmed, the menus aren't consistent because some games have more options than others. As such, there's really no way to automate this process other than by slave labor.

Posted

If you want to have your 'Slave Labor' change the dips, here is a script that will help. For each game in the Cocktail.txt list, the script will create an empty cfg for each game, so that the legal discalimer will be skipped (you won't have to type ok for each game) run each game in mame, and when the game is exited, run the next game on the list. Using the script would save quite a bit of time...

 

#SingleInstance force

; Enter these three variables
MameExe := "Mame.exe"
MamePath := "C:\Program Files\Mame0129"
RomPath := "D:\Mame 0.129 roms"

Line1 := "<?xml version=""1.0""?>"
Line2 := "<!-- This file is autogenerated; comments and unknown tags will be stripped -->"
Line3 := "<mameconfig version=""10"">"
Line4 := " <system name="
Line5 := "</mameconfig>"

Gui, Add, Text, w200 vMyText,
Gui, Add, Text, w200 y+5 vMyRom,
Gui, Show, x0 y0 h50 w200
Loop, read, %A_ScriptDir%\No Clones.txt
{
GuiControl,, Mytext, %A_Index%
GuiControl,, MyRom, %A_LoopReadLine%
IfNotExist, %MamePath%\cfg\%A_LoopReadLine%.cfg
{
FileAppend, %line1%`n%line2%`n%line3%`n%line4%"%A_LoopReadLine%" />`n%line5%`n, %MamePath%\cfg\%A_LoopReadLine%.cfg
Sleep, 500
RunWait, %MameExe% %A_LoopReadLine% -rompath "%RomPath%" -window, %MamePath%
}
}
^Q::
ExitApp

You will need to adjust the three variables (MameExe, MamePath, RomPath) to fit your paths, and setup.

You will need to download AutoHotKey: http://www.autohotkey.com/download/ and install it.

Copy and paste the text in the codebox into notepad, and save as "RunMame.ahk"

Copy and paste the text in cocktail.txt into notepad, and save as "Cocktail.txt"

Put RunMame.ahk, and Cocktail.txt into the same folder. (The folder name doesn't matter)

To run the script, double-click on RunMame.ahk

If you only want no-clone games, use the No Clones.txt file, but still Save as "Cocktail.txt"

The script checks to see if you already have a cfg for each game, so if you already have some done, it will skip those. This will also allow you quit (Press ctrl Q) and to run the script again later, picking up where you left off.

This sounds like a little bit of trouble, but it will greatly increase the speed of making the cfgs. Did I mention that I would like a copy of the cfgs? :)

CockTail.txt

No_Clones.txt

Posted

I was looking at this...

In the UI menu in Mame, under video options, is an option for cocktail. I don't think it is exactly what you were looking for, because it has a split screen effect, with each player having half of the screen right side up (kind of cool) . I think you were looking for the arcade cocktail mode, where the entire screen would rotate for each player.

I tried two games, and the cfg file was the same:

<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
<system name="005">
<video>
<target index="0" view="Cocktail" />
</video>
</system>
</mameconfig>

I couldn't find a command line switch for this, but possibly an entry in a ctrlr file would be all you would need.

Posted
I think you were looking for the arcade cocktail mode, where the entire screen would rotate for each player.

Correct. Thanks for continuing to ponder this Tempest.

I took a look at some of the source file drivers, and grepped for "cabinet"...but in the short amount of time I took to look it over, there didn't seem to be much consistency to the dip switch texts.

Anyhow, I'm still months away from this cab coming to fruition. Once it's playable I'll turn the slave labor on to it :lol:

Posted
Correct. Thanks for continuing to ponder this Tempest.

I can't help it, I'm obssesive...

I took a look at some of the source file drivers, and grepped for "cabinet"...but in the short amount of time I took to look it over, there didn't seem to be much consistency to the dip switch texts.

Anyhow, I'm still months away from this cab coming to fruition. Once it's playable I'll turn the slave labor on to it :lol:

I think I figured it out. I'm mostly just documenting it here so I won't forget!

I'm dealing strictly with "005"

I ran "005" in Mame, and set the dipswitch to "Cocktail". The entry in the 005.cfg file looks like:

<port tag="D3D2" type="DIPSWITCH" mask="4" defvalue="4" value="0" />

In Listxml.xml, the first line for "005" is: <game name="005" sourcefile="segag80r.c">

So I went to the Mame Source\src\mame\drivers\segag80r.c file, and found this:

static INPUT_PORTS_START( 005 )

PORT_INCLUDE(g80r_generic)

PORT_MODIFY("D7D6")

PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY

PORT_MODIFY("D5D4")

PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY

PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )

PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY

PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY

PORT_MODIFY("D3D2")

PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:8,7")

PORT_DIPSETTING( 0x00, "3" )

PORT_DIPSETTING( 0x02, "4" )

PORT_DIPSETTING( 0x01, "5" )

PORT_DIPSETTING( 0x03, "6" )

PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:6")

PORT_DIPSETTING( 0x04, DEF_STR( Upright ))

PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ))

PORT_MODIFY("FC")

PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL

PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_4WAY PORT_COCKTAIL

PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_COCKTAIL

PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_4WAY PORT_COCKTAIL

PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_4WAY PORT_COCKTAIL

INPUT_PORTS_END

I also found this article which explains what everything means:

The next section is a little different since it defines a dipswitch instead

of inputs. Even though it is a dipswitch it is still referred to as an input

port, in this case input port 2.

1 PORT_START /* DSW */

2 PORT_DIPNAME( 0x01, 0x01, "Cabinet", IP_KEY_NONE )

3 PORT_DIPSETTING( 0x01, "Upright")

4 PORT_DIPSETTING( 0x00, "Cocktail" )

5 PORT_DIPNAME (0x0a, 0x00, "Coinage", IP_KEY_NONE )

6 PORT_DIPSETTING ( 0x08, "2 Coins/1 Credit" )

7 PORT_DIPSETTING ( 0x00, "1 Coin/1 Credit" )

8 PORT_DIPSETTING ( 0x02, "1 Coin/2 Credits" )

9 /* 0x0a gives 2/1 again */

10 PORT_DIPNAME (0x04, 0x00, "Bonus Life", IP_KEY_NONE )

11 PORT_DIPSETTING ( 0x00, "5000" )

12 PORT_DIPSETTING ( 0x04, "10000" )

13 PORT_DIPNAME (0x30, 0x00, "Lives", IP_KEY_NONE )

14 PORT_DIPSETTING ( 0x00, "3" )

15 PORT_DIPSETTING ( 0x10, "4" )

16 PORT_DIPSETTING ( 0x20, "5" )

17 /* 0x30 gives 3 again */

18 PORT_DIPNAME (0x40, 0x00, "Unknown", IP_KEY_NONE )

19 PORT_DIPSETTING ( 0x00, "Off" )

20 PORT_DIPSETTING ( 0x40, "On" )

21 PORT_DIPNAME (0x80, 0x00, "Unknown", IP_KEY_NONE )

22 PORT_DIPSETTING ( 0x00, "Off" )

23 PORT_DIPSETTING ( 0x80, "On" )

Line 1 defines the start of the input port as usual.

Line 2 defines that start of the first section of the dipswitch. The first

parameter is the mask just like in a normal input port. Each bit that is a

1 in the mask will be effected by this dipswitch. The next parameter is the

default value for the dipswitch, in this case it is 0x01. The next parameter

is the name of the dipswitch, this will be displayed in the dipswitch menu

in MAME. The final parameter allows you to assign a key to control this

dipswitch. Since it is IP_KEY_NONE is means that there is no key to control it

and it has to be set on the dipswitch menu.

Lines 3 and 4 are PORT_DIPSETTINGs. These define the different settings for

the dipswitch section that we just defined. The first parameter in PORT_DIPSETTING

is the value that corresponds to the setting, and the second parameter is the name

of that setting. For example if the dipswitch "Cabinet" is set to "Upright"

then bit 0 of the port will be set to 0x01. If it is set to "Cocktail" then

bit 0 of the port will be set to 0x00.

Line 5 begins the definition of the next section of the dipswitch, this time

called "Coinage". Notice that there are two bits set in the mask meaning that

this dipswitch section can have more then two combination.

Lines 6-8 define the settings for the "Coinage" dipswitch. There are four

possible combinations for this dip section, but only 3 of them are defined.

As indicated by the comment in line 9, the fourth setting, 0x0A, is the

same as the setting for 0x08.

Lines 13-23 define the remained of the dipswitch sections and settings.

So in this section:

PORT_MODIFY("Port Tag=D3D2")

PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives )) PORT_DIPLOCATION("SW1:8,7")

PORT_DIPSETTING( 0x00, "3" )

PORT_DIPSETTING( 0x02, "4" )

PORT_DIPSETTING( 0x01, "5" )

PORT_DIPSETTING( 0x03, "6" )

PORT_DIPNAME( Mask=0x04 , DefValue=0x04, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW1:6")

PORT_DIPSETTING( 0x04, DEF_STR( Upright ))

PORT_DIPSETTING( Value=0x00, DEF_STR( Cocktail ))

<port tag="D3D2" type="DIPSWITCH" mask="4" defvalue="4" value="0" /> :)

Any Questions? :blink:<_<:o;)B) (Sorry, I got carried away!)

I will work on this, and see if I can add it to CFG Magician....

Posted

so would that mean you have to recompile mame with a changed segag80r.c driver?

i'm just trying to follow what you found out, tempest! i love your dedication to this problem mate!

Posted

Previously to get the cfg information for CFG Magician, I would have to run the games in Mame, and change the Inputs (in this case a dipswitch) to see what the Mask, Defvalue, and Port type were. Now (I hope) I can scan through the drivers, and get the information from there. If you go back, and read the entire thread (No disrespect intended, I just don't want to re-type everything) there were several problems with creating the cfg files with dipswitch information using an automated process in Mame.

If I can get this to work, It will be a nice way for me to get the information I need to generate cfg files. It will also make it much easier to be sure that the information is current. I hope that explains it, if it's still unclear, let me know, and I will go into more detail.

Posted

i was following the thread closely I just didnt know what your plans were with the obtained infos! thanks for making this clear!

I know this is about extending the capabilities of cfg magician... but wouldnt it be possible to recompile the drivers with cocktail being the standard dip switch setting?

Posted

Like I said, no disrespect intended (The only thing slower than my connection, is my typing)...

I also wasn't sure if you were aware of CFG Magician, and what it could do.

To answer your question, yes, that seems reasonable. If you would, give it a try in 1 driver ( I recommend tempest.c :D ).

Look at these three lines in tempest.c:

PORT_DIPNAME( 0x10, 0x10, DEF_STR( Cabinet ) ) ;The second number in this line is the Defvalue

PORT_DIPSETTING( 0x10, DEF_STR( Upright ) )

PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) ; We want to set it to this

So change: PORT_DIPNAME( 0x10, 0x10, DEF_STR( Cabinet ) )

To: PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )

Compile it, and see if it works. If it does, let me know, and I'll write a script to search through all of the drivers, and make the necessary changes.

Posted

So are you planning on changing the way CFG Magician works now? I mean, you currently take a directory full of cfg files and add the controls to them based on what controls are available for the game in the blank cfg. With the info from the drivers, you could see what's needed and build the file without needing the blank files? I'm not weighing in one way or the other, just curious?

Posted

Actually, I've been waiting for you to weigh in....

Off topic for a moment - Remember the confusion on whether or not two player alternating games like pacman used the second joystick control or not? Looking through the drivers, the machines had a second input for player 2, but only for Cocktail versions... at least that's the way I'm reading it.

My best guess on where I'm going with CFG Magician... I see this as two separate applications, CFG Magician, and a second utility that can be used to create the blank cfgs. I see this for two reasons:

1. It seems silly to parse all of the drivers every time CFG Magician is run.

2. If it is a separate app, the user would be able to create a set of blank cfgs for any version of Mame. So if you want to do something with your lightgun games, you would be able too.

Of course these are my preliminary thoughts, which aren't necessarily accurate, and I always consider what others may think. So, what do you think?

Posted

You could have it combined or separate. If you combine the two apps, don't make it mandatory to produce all the files (as you said), make it an option. I think it would be a very good thing to have some way of doing this so that you could poll MAME itself rather than being reliant on potentially outdated input cfg files. The problem I see is that you would be requiring people to download the source for MAME (unless you can get this data from the xml file MAME generates).

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