Difference between revisions of "Guides:MAME - Networking"

From Wah!ki
Jump to navigation Jump to search
Line 10: Line 10:
  
 
MAME only looks at the /dev/net/tun device currently (0.229) so it wont support macvtap devices etc atm.
 
MAME only looks at the /dev/net/tun device currently (0.229) so it wont support macvtap devices etc atm.
 +
 +
 +
The naming convention of the tap device is important, otherwise MAME doesn't seem to know what to use. I haven't found the supported code for that tho
  
  
Line 33: Line 36:
 
   $ MAMESTATIC=192.168.0.102
 
   $ MAMESTATIC=192.168.0.102
 
   $ HOSTIP=192.168.0.200
 
   $ HOSTIP=192.168.0.200
   $ TAP=mametap0
+
   $ TAP=tap-mess-1004-0
 
   $ USERNAME=$(whoami)
 
   $ USERNAME=$(whoami)
 
   $ sudo ip tuntap add dev $TAP mode tap user $USERNAME
 
   $ sudo ip tuntap add dev $TAP mode tap user $USERNAME

Revision as of 22:18, 20 March 2021

(Ether)net Networking in MAME

Support was added back in ~2012 but the documentation is fragmented.

Very basically you will

  • give the MAME machine a static ip internally,

on the host

  • tweak some ipv4 network behavior
  • create a basic tap device
  • route traffic out the hosts eth int

MAME only looks at the /dev/net/tun device currently (0.229) so it wont support macvtap devices etc atm.


The naming convention of the tap device is important, otherwise MAME doesn't seem to know what to use. I haven't found the supported code for that tho


List MAME Networks

mame -listnetwork will display available devices as per below

$ ./mame -listnetwork
Available network adapters:
    TAP/TUN Device


tap device setup

Manual setup

  1. Allow forwarded traffic, and proxied arp requests
  2. Create a tap device and route traffic across you host ethernet
  3. confirm you have read access to the /dev/net/tun device
  # echo 1 > /proc/sys/net/ipv4/ip_forward
  # echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp
  # chmod 666 /dev/net/tun

  $ MAMESTATIC=192.168.0.102
  $ HOSTIP=192.168.0.200
  $ TAP=tap-mess-1004-0
  $ USERNAME=$(whoami)
  $ sudo ip tuntap add dev $TAP mode tap user $USERNAME
  $ sudo ip link set $TAP up arp on
  $ sudo ip addr replace dev $TAP $HOSTIP/32
  $ sudo ip route replace $MAMESTATIC via $HOSTIP dev $TAP 

  $ ip link show $TAP
  $ ip route

MAME Script

MAME has a script in the git repo /src/osd/sdl/taputil.sh

NOTE: be mindful of this script, it will not honor existing tap perms nor kernel settings see #7877

MAME Setup

In the in-game UI

  • open the Network Devices menu and select "TAP/TUN Device"
  • Confirm the IRQ under machine configuration is correct
IRQs

Just a note on my config,

  • ISA1 svga_s1,
  • ISA2, sblaster_16 (IRQ5)
  • ISA4 ne2000.

The IRQ used by the ne2000 adapter would only work on IRQ2/9

DOS Setup

Load the ne2000 drivers from in autoexec.bat, try auto discovery first

c:\PATH\TO\NE2000.COM 0x60

A decent test suite of tools while getting setup is the mTCP project, refer to their doco to setup the config etc. but remove LEASE_TIME from the ip settings to set a static ip for use with the applications otherwise the applications will throw a lease expired warning and exit

Drivers/Software

References