Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: TreX on December 18, 2015, 08:19:33 pm

Title: Mame + Motors + Punch/Fighting mania. What should i do to hook?
Post by: TreX on December 18, 2015, 08:19:33 pm
Hellou arcade community.

This is the standart first post^^. I am not a native english speaker but i will try to do my best.

I woke up today with the idea to build a Punching Mania simulator. Sadly i could not find a similar topic on the whole internet.
It`s my first time with mame but not the first project on building special input devices. I also have some skills in game development and a basic understanding of Hardware.

How far am I (not very far):

 I got the roms to run with mames last build... somehow. (no sound on Fightingmania befor upgrade to punch and some weird bugs with autofire on some mame builds).

What I want:

To play the game you have to hit the paddles wich are coming at you when the led lights on the paddles are on.
I think the process is something like.
-->Turn Motor on(I think the game can read the position of it 0....255)
-->when motor/paddle reach position 255--> light up the led. (maybe there is a switch to signalize the fuly extended paddle)
-->(decrementing healt if no reaction)
--> on hit, the game gets a simple button press input.
--> retracting the paddles

--> If paddles are blocked and/or you dont hit them in time you get a MISS
--> Paddles auto retract

Now the big BUUUT
Mame has a some shortcuted procedure.
The states are indicated buy a simple string.
Like  (555*50)
5 = paddle is ready
* = led on(ready to hit)
0 = paddle retracting???
The motors are going from 0 to 255 in a blink of an eye and so you have a to little  time to react after the led goes on.
If you hit or miss Motors are going to 0

When i tried to read the outputs with  Mame Hooker I just got the Paddle LEDs and the Selection LEDs

But I want the motor signals and the ability to make this 0...255 inputs or at least 2 different states(motor min and motor max) that i am giving to the game mechanicly and not from  mames auto pilot.

I think I have to compile mame with some addditional own code. But since i dont worked with mame i dont know where those changes where(or should be) made by the developers(i am pretty sure they simulated the motor inputs in mame). Next i will need some hooks for mame hooker and at least 6 more buttons for the game^^.

Where do I start what is the proper way^^.

and btw how  do I get rid of autofire.

If there is someone who can provide any information on the cabinet mechanics or the game itself I would be very happy.

Thx
TreX
 
Title: Re: Mame + Motors + Punch/Fighting mania. What should i do to hook?
Post by: PL1 on December 18, 2015, 09:45:24 pm
Welcome aboard, TreX.   ;D

It looks like a really complicated controller build if you try to do moving target paddles like the arcade version.

http://www.youtube.com/watch?v=Tnxi5-b7J9c (http://www.youtube.com/watch?v=Tnxi5-b7J9c)

Seems like it would be much easier to use fixed targets since this is your first build.   :dunno

Howard_Casto's MameHooker program should allow you to hook up the lights on the targets if you don't want the on-screen fist indicators. (0:41 and 2:20 in this video)

http://youtu.be/HSp9IiQEwAw?t=140 (http://youtu.be/HSp9IiQEwAw?t=140)


Scott
Title: Re: Mame + Motors + Punch/Fighting mania. What should i do to hook?
Post by: TreX on December 18, 2015, 10:39:03 pm
Thank you for the fast reply.

I dont think that it is very complicated maybe somehow expensive if i would use my prefered parts. So yes like you where saying i will build a static prototype first, then maybe a springloaded one(fully moving but no motors required) in which you use the "punch" to load the springs and a simple relais to let the paddles go.(not very suited for this game cause you will need a little bit of "power" in every hit). Dont wory i have some skills in crafting wood and iron and circutery.
And if i get a glimpse how the real arcade works i will recreate it somehow.^^
But first is first i need that damn game logic and the outputs. ;D

In that Video of yours I can see that the game outputs the signals wihout the "real" motor/pad motion delays but it would be enough to start to build the static and the springloaded one...

And again the big BUT thing:

...but i dont know how to get all the states out of the game to MameHooker the only one i can get out are the LEDs. I need at least 6 more for pad ready status (and optional 6 for pad closed) represented buy the 0 and the 5
I even think that the "pads ready" triger is trigering the LEDs on the pads

This is what i can get out with Mame Hooker:

Code: [Select]
Emulator=MAME
Game Info:
----------
Rom=pnchmn2
Parent=pnchmn2
Driver=
Orientation=0

Outputs:
--------
12348=select left right=0
12349=left bottom lamp=0
12350=left middle lamp=0
12351=start lamp=0
12352=left top lamp=0
12353=right middle lamp=0
12354=right top lamp=0
12355=right bottom lamp=0
only the lights.

I will post the debug menu from the Cabinet after a little breake.

I think my first question would be where do i have to "hack" to have influence on the on screen fist indicators? I think it would be somwhere deep in MAME or is it in the ROM or BIOS?

Title: Re: Mame + Motors + Punch/Fighting mania. What should i do to hook?
Post by: PL1 on December 18, 2015, 11:17:10 pm
I think my first question would be where do i have to "hack" to have influence on the on screen fist indicators? I think it would be somwhere deep in MAME or is it in the ROM or BIOS?
Can't verify with my version of MAME, but try this:
- Launch the game
- Press Tab to bring up the menu
- Select the Video Options menu
- There will probably be several options at the top (Upright Artwork, Standard 4:3, Cocktail, etc.)
- Select "Standard 4:3" -- That should give you the regular arcade monitor display without the fist overlays.   ;D


Scott
Title: Re: Mame + Motors + Punch/Fighting mania. What should i do to hook?
Post by: TreX on December 19, 2015, 06:39:06 pm
Sry but it is not working.
Also it was not what i wanted to achieve.

I found the part where i can start from. Its this file -->mame\src\mame\drivers\ksys573.cpp

Somwhere here are the controlls for the I/O i supose:
Code: [Select]
/* punch mania */


ADC083X_INPUT_CB(konami573_cassette_xi_device::punchmania_inputs_callback)
{
ksys573_state *state = machine().driver_data<ksys573_state>();
double *pad_position = state->m_pad_position;
int pads = state->m_pads->read();
for( int i = 0; i < 6; i++ )
{
if( ( pads & ( 1 << i ) ) != 0 )
{
pad_position[ i ] = 5;
}
}

switch( input )
{
case ADC083X_CH0:
return pad_position[ 0 ]; /* Left Top */
case ADC083X_CH1:
return pad_position[ 1 ]; /* Left Middle */
case ADC083X_CH2:
return pad_position[ 2 ]; /* Left Bottom */
case ADC083X_CH3:
return pad_position[ 3 ]; /* Right Top */
case ADC083X_CH4:
return pad_position[ 4 ]; /* Right Middle */
case ADC083X_CH5:
return pad_position[ 5 ]; /* Right Bottom */
case ADC083X_COM:
return 0;
case ADC083X_VREF:
return 5;
}
return 5;
}


static MACHINE_CONFIG_FRAGMENT( punchmania_cassette_install )
MCFG_DEVICE_MODIFY( "adc0838" )
MCFG_ADC083X_INPUT_CB( konami573_cassette_xi_device, punchmania_inputs_callback )
MACHINE_CONFIG_END


int pad_light[ 6 ];

WRITE8_MEMBER( ksys573_state::punchmania_output_callback )
{
double *pad_position = m_pad_position;
char pad[ 7 ];

switch( offset )
{
case 8:
output_set_value( "select left right", !data );
break;
case 9:
pad_light[ 2 ] = !data;
output_set_value( "left bottom lamp", !data );
break;
case 10:
pad_light[ 1 ] = !data;
output_set_value( "left middle lamp", !data );
break;
case 11:
output_set_value( "start lamp", !data );
break;
case 12:
pad_light[ 0 ] = !data;
output_set_value( "left top lamp", !data );
break;
case 13:
pad_light[ 4 ] = !data;
output_set_value( "right middle lamp", !data );
break;
case 14:
pad_light[ 3 ] = !data;
output_set_value( "right top lamp", !data );
break;
case 15:
pad_light[ 5 ] = !data;
output_set_value( "right bottom lamp", !data );
break;
case 16:
if( data )
{
pad_position[ 0 ] = 0; // left top motor +
}
break;
case 17:
if( data )
{
pad_position[ 1 ] = 0; // left middle motor +
}
break;
case 18:
if( data )
{
pad_position[ 1 ] = 5; // left middle motor -
}
break;
case 19:
if( data )
{
pad_position[ 0 ] = 5; // left top motor -
}
break;
case 20:
if( data )
{
pad_position[ 2 ] = 0; // left bottom motor +
}
break;
case 21:
if( data )
{
pad_position[ 3 ] = 5; // right top motor -
}
break;
case 22:
if( data )
{
pad_position[ 3 ] = 0; // right top motor +
}
break;
case 23:
if( data )
{
pad_position[ 2 ] = 5; // left bottom motor -
}
break;
case 26:
if( data )
{
pad_position[ 5 ] = 0; // right bottom motor +
}
break;
case 27:
if( data )
{
pad_position[ 4 ] = 0; // right middle motor +
}
break;
case 30:
if( data )
{
pad_position[ 4 ] = 5; // right middle motor -
}
break;
case 31:
if( data )
{
pad_position[ 5 ] = 5; // right bottom motor -
}
break;
}
sprintf( pad, "%d%d%d%d%d%d",
( int )pad_position[ 0 ], ( int )pad_position[ 1 ], ( int )pad_position[ 2 ],
( int )pad_position[ 3 ], ( int )pad_position[ 4 ], ( int )pad_position[ 5 ] );

if( pad_light[ 0 ] ) pad[ 0 ] = '*';
if( pad_light[ 1 ] ) pad[ 1 ] = '*';
if( pad_light[ 2 ] ) pad[ 2 ] = '*';
if( pad_light[ 3 ] ) pad[ 3 ] = '*';
if( pad_light[ 4 ] ) pad[ 4 ] = '*';
if( pad_light[ 5 ] ) pad[ 5 ] = '*';

popmessage( "%s", pad );
}

DRIVER_INIT_MEMBER( ksys573_state,pnchmn )
{
gx700pwfbf_init( &ksys573_state::punchmania_output_callback );
}



I will tinker around and try to get those motor I/Os to work and aply some hooks to them.... also need to recompile mame now xD.

Is it the right file where i can mess with the motors? First i want to simulate their behaiviour and then make I/Os to put real motors instead.
If someone has this cabinet could you plz contact me. I need some verification on how the cabinet "should" work.