MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Pages: 1

Rockman
MAME Fan
Reged: 08/23/12
Posts: 31
Send PM


A silly question about Mame drivers structure.
#307957 - 04/28/13 03:55 PM


Hi guys!

I have recently been playing with the Mame source code adding a few clones (Newbie level).

I have succeeded with older versions of Mame, but I not undestand the "new" fields of the structure of the drivers. They are not documented in Mamedev . Maybe it's a silly question, but I have not found the answer.

Can someone explain the differences between the old mame driver declaration structure, with the actual driver declaration of the games?

Old declaration in pacman.c (as in the DevWiki in Mamedev)
GAME( 1980, puckman, 0, pacman, pacman, 0, ROT90, "Namco", "PuckMan (Japan set 1)", GAME_SUPPORTS_SAVE )
GAME( 1980, puckmana, puckman, pacman, pacman, 0, ROT90, "Namco", "PuckMan (Japan set 2)", GAME_SUPPORTS_SAVE )

And the actual declaration: found in actual pacman.c:
GAME( 1980, puckman, 0, pacman, pacman, driver_device, 0, ROT90, "Namco", "Puck Man (Japan set 1)", GAME_SUPPORTS_SAVE )
6209 GAME( 1980, puckmana, puckman, pacman, pacman, driver_device, 0, ROT90, "Namco", "Puck Man (Japan set 2)", GAME_SUPPORTS_SAVE )


Specifically the "driver_device" "pacman_state" field use.

There is in somewhere an updated version of the guide for developers in mamedev?

Thanks. :P



etabeta
Reged: 08/25/04
Posts: 2036
Send PM


Re: A silly question about Mame drivers structure. new [Re: Rockman]
#308073 - 04/30/13 07:49 AM


> Specifically the "driver_device" "pacman_state" field use.

as you might notice, most variables/handlers used in drivers are now part of a C++ class, specific of the driver. among other things, we are migrating to the driver classes also some initialization code, including the functions usually hidden behind MACHINE_START/MACHINE_RESET/DRIVER_INIT macros

However, in order to move the DRIVER_INIT ones into the class, we needed the GAME macro to be aware of a 'reference' class where to find the DRIVER_INIT function. As such, if a driver had no DRIVER_INIT function in the old code, it just references the generic "driver_device" class...


> There is in somewhere an updated version of the guide for developers in mamedev?

no there is not



Rockman
MAME Fan
Reged: 08/23/12
Posts: 31
Send PM


Re: A silly question about Mame drivers structure. new [Re: etabeta]
#308156 - 05/01/13 06:12 PM


Etabeta thank you very much for your answer.

I was not expecting a very technical description from the point of view of C++ and their classes, etc., but I guess that was the answer to my question. I'm not a programmer. I would like more of a practical point of view.

I'm in the process of understanding, a very basic, the process of adding a clone Mame source code. And I got stuck when trying to understand the new field of the Macro "Game" and use it.

In the source code of older versions of Mame got add clones without too much trouble. (Studying some documents Mamedev)

Now I have understood that (you can correct me if I'm wrong):

In the field number 6 in GAME macro
- Driver_device: If you have a call to a "DRIVER_INIT_MEMBER" (do not need specific initialization)
- Pacman_state: variable (or its correct name) used in the initialization of the functions MACHINE_START, MACHINE_RESET, DRIVER_INIT, etc.

In the field number 7 GAME
-0: used with "driver_device" in field 6, for a not need for specific initialization.
maketrax / pacplus / eyes: variables used for call the specific initialization functions.

Apologies if I do not express things thoroughly ...sorry.

It would be correct, if I create a new init: pacman_state, rockman, in my MACRO:
GAME (1981, rockman, crush, pacman, maketrax, pacman_state, rockman, ROT90, "Alpha Denshi Co. / Samno Kural Electric, Ltd.", "Crush Roller (set 1)", GAME_SUPPORTS_SAVE)

From which it can call:
MACHINE_CONFIG_DERIVED static (pacman_state, rockman)
MCFG_CPU_MODIFY ("maincpu")
MCFG_CPU_CLOCK (6000000)
MACHINE_CONFIG_END

In this way I can create a new clone called "rockman", from the game "crush" modifying its initialization with a main CPU overclock.

(I know it should create the ROM START and add it to the master list of drivers, etc, etc)
I just want understand the driver inits and understand the process of creating a new clone.

Thank you very much and apologies for my ignorance on the matter.:P



etabeta
Reged: 08/25/04
Posts: 2036
Send PM


Re: A silly question about Mame drivers structure. new [Re: Rockman]
#308318 - 05/05/13 05:24 PM


no, you got it partially wrong

MACHINE_CONFIG is parameter 5
fields 6 & 7 go in pair and only refers to DRIVER_INIT.

so in your case, since you're modifying MACHINE_CONFIG the correct GAME is


Code:

GAME (1981, rockman, crush, pacman, rockman, driver_device, 0, ROT90, "Alpha Denshi Co. / Samno Kural Electric, Ltd.", "Crush Roller (set 1)", GAME_SUPPORTS_SAVE)



unless you also define a new DRIVER_INIT too...



Rockman
MAME Fan
Reged: 08/23/12
Posts: 31
Send PM


Re: A silly question about Mame drivers structure. new [Re: etabeta]
#308484 - 05/09/13 11:36 AM


Hi etabeta.

I managed to add and compile an overclocked version of an existing game with your advice.

Just a small detail, MachineConfig is the fourth parameter. Fifth are for the input port definitions.

Thanks etabeta for your masterclass to a rookie

Edited by Rockman (05/09/13 11:36 AM)


Pages: 1

MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Pi 
0 registered and 41 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 3177