Build Your Own Arcade Controls Forum

Main => Main Forum => Topic started by: dgame on December 17, 2012, 02:17:32 pm

Title: Single Joystick control of Battle Zone?
Post by: dgame on December 17, 2012, 02:17:32 pm

EDIT: Dawgz Rule posted an easier solution below. I included the full solution in my post below.


Hi,

I was admiring rockyrocket's  Tempest(ish) caberet cab http://forum.arcadecontrols.com/index.php/topic,123455.0 (http://forum.arcadecontrols.com/index.php/topic,123455.0)

Since he put on Battle Zone stickers and only has one joystick I wanted to recommend the single joystick control Battle Zone MAME patch.

I read his thread again and it seems he is using the AAE Emulator which I think still has the single joystick hack.

But now I want to have the Battle Zone single stick hack in my MAME setup.

EDIT: Dawgz Rule posted an easier solution below. I included the full solution in my post below.

I found the 141u1 patch here http://forum.arcadecontrols.com/index.php/topic,108813.msg1155082.html (http://forum.arcadecontrols.com/index.php/topic,108813.msg1155082.html) but it does not work with 147 sources as things are different now.

I manually put the changes into the new source code.

The input_port_read() no longer exists in MAME. More on this here: http://mame.dorando.at/svn/?start=16119
 (http://mame.dorando.at/svn/?start=16119)
I tried to use the ioport function but don't quite understand how to translate the changes into the new MAME format.


This is what the patch adds/changes in the Battle Zone code:

mame/audio/bzone.c:
Code: [Select]
/* Translation table for one-joystick emulation */
static UINT8 one_joy_trans[] =
{
0x00,0x0A,0x05,0x00,0x06,0x02,0x04,0x00,
0x09,0x08,0x01,0x00,0x00,0x00,0x00,0x00
};

static READ8_DEVICE_HANDLER( bzone_IN3_r )
{
int res = input_port_read(device->machine, "IN3");
if (input_port_read(device->machine, "SELECT") == 1)
res |= one_joy_trans[input_port_read(device->machine, "FAKE") & 0x0f];
return res;
}

static const pokey_interface bzone_pokey_interface =
{
{ DEVCB_NULL },
DEVCB_HANDLER(bzone_IN3_r)
};

mame/drivers/bzone.c:
Code: [Select]
static INPUT_PORTS_START( bzone )
BZONEIN0
BZONEDSW0
BZONEDSW1

PORT_START("IN3")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN ) PORT_2WAY PORT_CONDITION("SELECT",0x01,EQUALS,0x00)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP ) PORT_2WAY PORT_CONDITION("SELECT",0x01,EQUALS,0x00)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN ) PORT_2WAY PORT_CONDITION("SELECT",0x01,EQUALS,0x00)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP ) PORT_2WAY PORT_CONDITION("SELECT",0x01,EQUALS,0x00)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )

PORT_START("SELECT")
    PORT_CONFNAME( 0x01, 0x00, "Controller Type" )
    PORT_CONFSETTING(    0x00, "Real" )
    PORT_CONFSETTING(    0x01, "8-way Joystick" )

PORT_START("FAKE")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_CONDITION("SELECT",0x01,EQUALS,0x01)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_CONDITION("SELECT",0x01,EQUALS,0x01)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_CONDITION("SELECT",0x01,EQUALS,0x01)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_CONDITION("SELECT",0x01,EQUALS,0x01)

BZONEADJ
INPUT_PORTS_END


The diff file is here http://forum.arcadecontrols.com/index.php?action=dlattach;topic=108813.0;attach=160066 (http://forum.arcadecontrols.com/index.php?action=dlattach;topic=108813.0;attach=160066)

Can this single stick Battle Zone hack be made to work with current MAME?

Thanks!


EDIT: Dawgz Rule posted an easier solution below. I included the full solution in my post below.
Title: Re: Single Joystick control of Battle Zone?
Post by: Dawgz Rule on December 17, 2012, 07:02:29 pm
No clue about the single stick hack but you can modify the cfg file to do the same.  Here is what worked for me.....
Code: [Select]
<input>
            <port tag="IN3" type="P1_JOYSTICKRIGHT_DOWN" mask="1" defvalue="0">
                <newseq type="standard">
                    KEYCODE_RIGHT OR KEYCODE_DOWN
                </newseq>
            </port>
            <port tag="IN3" type="P1_JOYSTICKRIGHT_UP" mask="2" defvalue="0">
                <newseq type="standard">
                    KEYCODE_LEFT OR KEYCODE_UP
                </newseq>
            </port>
            <port tag="IN3" type="P1_JOYSTICKLEFT_DOWN" mask="4" defvalue="0">
                <newseq type="standard">
                    KEYCODE_LEFT OR KEYCODE_DOWN
                </newseq>
            </port>
            <port tag="IN3" type="P1_JOYSTICKLEFT_UP" mask="8" defvalue="0">
                <newseq type="standard">
                    KEYCODE_RIGHT OR KEYCODE_UP
                </newseq>
            </port>
        </input>
Title: Re: Single Joystick control of Battle Zone?
Post by: dgame on December 17, 2012, 08:41:02 pm
Thank you Dawgz Rule,

That did it!

I set it up for P1 Joystick or Keyboard input and here is the bzone.cfg:
Code: [Select]
<?xml version="1.0"?>
<!-- This file is autogenerated; comments and unknown tags will be stripped -->
<mameconfig version="10">
    <system name="bzone">
        <counters>
            <coins index="0" number="24" />
        </counters>
        <input>
            <port tag=":IN3" type="P1_JOYSTICKRIGHT_DOWN" mask="1" defvalue="0">
                <newseq type="standard">
                    JOYCODE_1_XAXIS_RIGHT_SWITCH OR JOYCODE_1_YAXIS_DOWN_SWITCH OR KEYCODE_RIGHT OR KEYCODE_DOWN
                </newseq>
            </port>
            <port tag=":IN3" type="P1_JOYSTICKRIGHT_UP" mask="2" defvalue="0">
                <newseq type="standard">
                    JOYCODE_1_XAXIS_LEFT_SWITCH OR JOYCODE_1_YAXIS_UP_SWITCH OR KEYCODE_LEFT OR KEYCODE_UP
                </newseq>
            </port>
            <port tag=":IN3" type="P1_JOYSTICKLEFT_DOWN" mask="4" defvalue="0">
                <newseq type="standard">
                    JOYCODE_1_XAXIS_LEFT_SWITCH OR JOYCODE_1_YAXIS_DOWN_SWITCH OR KEYCODE_LEFT OR KEYCODE_DOWN
                </newseq>
            </port>
            <port tag=":IN3" type="P1_JOYSTICKLEFT_UP" mask="8" defvalue="0">
                <newseq type="standard">
                    JOYCODE_1_XAXIS_RIGHT_SWITCH OR JOYCODE_1_YAXIS_UP_SWITCH OR KEYCODE_RIGHT OR KEYCODE_UP
                </newseq>
            </port>
        </input>
    </system>
</mameconfig>

This enables the tank in Battle Zone to be controlled using a single joystick or the keyboard arrow keys.
Title: Single Joystick control of Battle Zone?
Post by: cmoses on December 18, 2012, 12:31:46 am
Looks very interesting I will have to give this a try.
Title: Re: Single Joystick control of Battle Zone?
Post by: Dawgz Rule on December 18, 2012, 05:28:23 am
Good to hear.  Took a little bit of time to figure out with a pad and paper but it was well worth it.  Enjoy.