Re: Help with MAME source (read on)


[ Follow Ups ] [ Post Followup ] [ Build Your Own Arcade Controls message board ] [ FAQ ]

Posted by Bill Lash on 2, 2000 at 5:30 PM:

In Reply to: Help with MAME source (read on) posted by EmuMannen on 2, 2000 at 4:01 AM:

: I have started to browse the MAME sorce to find the format of the [mamedir]\cfg\[game].cfg files. It is like looking for a needle in a haystack. So could some one that knows the source inside and out please point me in the right direction (struct, function, .c or .h file etc). Thanks in advance for any help that might speed things up a bit...

: / EmuMannen

It looks to me like most of the code for dealing with the cfg files, at least for the controls part of it, is in inptport.c. It looks like the code for reading the information has to deal with several versions of the cfg files (i.e. v5, v6, v7, and v8), but the code for writing the v8 files doesn't look too hairy. I think the best starting function to look at is save_input_port_settings(). Be careful of the #ifdefs for MAME_NET. If I read the source correctly, the file contains:

A version identifier
A count of the total number of controls
All the default control settings
All of the current control settings
All of the coin counters
The total number of dispensed tickets
The Mixer configuration

The version identifier for a v8 save file should be the string "MAMECFG\x8"
The count of the total number of controls is stored as an UINT32 written to the file Least Significant byte first.
When storing control settings, each setting is stored as a type stored as a UINT32 followed by something called mask stored as a uin16 (LSB first), followed by something called default_value, also stored as a uint16, followed by a sequence. The sequence is made up of a length stored as a uint16, followed by a list of uint16s that define the sequence.
Each coin counter is stored as a uint32
The ticket counter is stored as a uint32
The mixer configuration is stored as (looking in sound/mixer.c) two bytes for each mixer channel, the first byte being something called default_levels, and the second being something called mixing_levels.

: : You are probably right but I am (like most programmers) quite lazy so I would prefere some documentation (if there is one) instead of browsing sorce code. I don't know if the .cfg format is Mame or Allegro native, it is in binary format and different sizes for different games (so it is probably not a simple generic struct shared by all games). Well I might have to browse the source after all to get an answer...

: : / EmuMannen

: : : Couldn't the format of cfg files be found by looking at the mame source?

: : : : Your question is interesting and I think that it would be possible for me to write a program that would do what you want if I only knew the format of the .cfg files in the cfg mame sub directory. Do any one know where I can find documentation of the format of the .cfg files?

: : : : / EmuMannen

: : : : : My control panel has two joysticks. Both of the sticks work perfectly in MAME. The left joystick uses a keyboard hack (arrow keys), and the right uses a gamepad hack (wired to gameport). This is great for ArcadeOS, because either stick will select games. MAME allows you to use either the joystick1 or keyboard arrows, so both sticks work identically by default.

: : : : : HOWEVER...

: : : : : I configured MAME (TAB defaults) so that player one uses the stick on the left and player two uses the stick on the right. This is great for two player (simultaneous) games (such as Joust). However, for single stick games (such as Pac-Man), it would be preferable to allow the use of either stick for player one or player two. That is, you could use whichever stick is more comfortable to you! However, I have to individually edit the MAME settings for every single stick game to allow the use of either stick.

: : : : : This is probably impossibly difficult to follow (if you are still reading).

: : : : : What I want to be able to do is configure all "single joystick" games to use either stick (the MAME default), while all simultaneous two+ player games (like Bubble Bobble, Simpsons, Joust, etc.) will use left for player 1 and right for player 2. Additionally, I would like Robotron and Crazy Climber to use both sticks.

: : : : : Anyway, I was wondering if there is any way to do this automatically (or an easier alternative), or does each game have to be edited individually?

: : : : : If you're still with me on this, nice job! Any help would be wildly appreciated.

: : : : : Thanks,

: : : : : noeltox




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ Build Your Own Arcade Controls message board ] [ FAQ ]