Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Single Joystick control of Battle Zone?  (Read 6466 times)

0 Members and 1 Guest are viewing this topic.

dgame

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 620
  • Last login:June 01, 2025, 11:09:55 pm
  • I am no Jedi
Single Joystick control of Battle Zone?
« 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

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 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

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

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.
« Last Edit: December 17, 2012, 08:49:31 pm by dgame »

Dawgz Rule

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 737
  • Last login:August 22, 2024, 07:18:55 pm
  • The more people I meet, the more I like my dogs
Re: Single Joystick control of Battle Zone?
« Reply #1 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>

dgame

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 620
  • Last login:June 01, 2025, 11:09:55 pm
  • I am no Jedi
Re: Single Joystick control of Battle Zone?
« Reply #2 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.

cmoses

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 718
  • Last login:July 27, 2023, 05:19:00 pm
Single Joystick control of Battle Zone?
« Reply #3 on: December 18, 2012, 12:31:46 am »
Looks very interesting I will have to give this a try.

Dawgz Rule

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 737
  • Last login:August 22, 2024, 07:18:55 pm
  • The more people I meet, the more I like my dogs
Re: Single Joystick control of Battle Zone?
« Reply #4 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.