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: Mame Outputs and Arduino  (Read 7737 times)

0 Members and 1 Guest are viewing this topic.

white_ghost

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 20
  • Last login:Today at 02:49:54 am
Mame Outputs and Arduino
« on: March 01, 2019, 04:59:30 am »
Hi all,
This post/software only concerns DIY(free) enthusiasts people.
A (very) little knowledge is needing about arduino programmation and hardware

It's a little utility for Mame : Simple Use of Mame Output.
Warning this project is only at early alpha stage and it was originally not intended to be shared, just for my personnal test/use but could be useful for some of you (or not)

This little program will allow you to retrieve the Mame outputs or Supermodel outputs such as lamp, led, digits states. Datas that you can processed on an arduino (or other hardware with serial com port) to switch on/off toys on your own system (ie : blinking start button, view buttons like in real arcade cabinet....). It's really easy to make your own arduino sketch for that (read the readme)
I add also the possibility to use motor datas with your wheel or rumble pad. However not really usefull because a few games have these sort of outputs in Mame. Furthermore, it's my own interpretation of the datas : raw datas converted to directinput, it doesn't reflect real effects

given as is, use it at your own risk ;)
tested under win 7 with arduino, g27 and xbox360 pad
no ideas if it works with other hardware

https://yadi.sk/d/K3tAthypsbfiNQ

happy DIY

othar

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 5
  • Last login:November 27, 2023, 09:44:32 am
  • I want to build my own arcade controls!
Re: Mame Outputs and Arduino
« Reply #1 on: May 01, 2019, 03:47:44 pm »
thanks.. i was searching something like that

Eduardoml

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:April 07, 2024, 07:53:59 pm
  • I want to build my own arcade controls!
Re: Mame Outputs and Arduino
« Reply #2 on: October 03, 2019, 05:20:10 pm »
Hi,
I was looking for a simple solution to use the lamps in an Offroad Challenge cab i'm converting to mame (it's hard for me to import a ledwiz into my country) and i found your post and it was just what i was looking for but i have some doubts. can I use with the Boomslang FFB Arcade plugin? Can there be some kind of conflict? Can I use the original 12volt bulbs or should I use 5volt LEDs?

Another thing is that I am struggling to understand how to create the program for Arduino, if not asking too much could you please post some real example of ino file with a simple wiring diagram so that I can better understand how to do it in my case? If you want I can help with testing on different hardware and etc.

Thanks.

white_ghost

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 20
  • Last login:Today at 02:49:54 am
Re: Mame Outputs and Arduino
« Reply #3 on: October 04, 2019, 03:52:56 am »
hi,
you can use it with arcade ffb plugin if you shutoff the ffb part of my project (select "none" in the ffb device list)

you can command what ever you want with an arduino (or equivalent), it's just a question of electronic design
an arduino can drive a simple led directly (resistor+led)
you can use a transistor witch commands a simple relay for a 12v light bulb  (don't forget the bypass diode in this case)
you can use a mosfet to command a 12v light bulb
it's really easy to find schematics about that on the net

Eduardoml

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:April 07, 2024, 07:53:59 pm
  • I want to build my own arcade controls!
Re: Mame Outputs and Arduino
« Reply #4 on: October 04, 2019, 01:07:30 pm »
Thanks for the help, as you suggested I used relays to turn on the 12v lamps and managed to make them work with the Arduino with some basic sketches, but as I have only very basic programming knowledge I am not able to do the Arduino sketch to use with your project, the read me tells me to do an if of the next character after L, but I don't know how to do these syntaxes and process data, etc., but I don't know what that means, I'm lost.  :dizzy:
If you can post a basic real example of ino and ini (for some example rom) files I can adapt and understand by trial and error and that would be a big help.

Thanks.

white_ghost

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 20
  • Last login:Today at 02:49:54 am
Re: Mame Outputs and Arduino
« Reply #5 on: October 05, 2019, 03:15:22 am »
re,
I've sent you yesterday a skeleton sketch for arduino, you'll only need to process the datas to your outputs, read your pm
you have multiple example of ini in the archive
ie : outrun
in the ini I've assigned
Start_lamp=lamp2
Brake_lamp=lamp1

so your arduino will receive
=L001 this means Lamp number 01 is off
=L101 this means Lamp number 01 is on
=L002 this means Lamp number 02 is off
=L102 this means Lamp number 01 is on

in the sketch, datas are located in
leds : value 0 to 99 represents the led number (warning to the leds=leds-1 in the sketch)
leds_state : state of the led (0 -> off, 1 -> on)

you'll just have to make simple tests on these datas to switch on/off the right outputs of your arduino

Eduardoml

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 18
  • Last login:April 07, 2024, 07:53:59 pm
  • I want to build my own arcade controls!
Re: Mame Outputs and Arduino
« Reply #6 on: October 08, 2019, 02:24:12 pm »
Sorry I did not see that you had sent me a private message, with the example file I could understand, did some tests and it worked perfectly, thank you.  :)

Gonx

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:March 30, 2021, 04:13:12 pm
  • I want to build my own arcade controls!
Re: Mame Outputs and Arduino
« Reply #7 on: March 28, 2021, 02:52:49 pm »
Hello I am new in this subject and I am interested in this, is there any new topic about the subject?
I also need an example of the ini file and the arduino program to understand the commands, could be a simple one like digdug.

Tanks

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9401
  • Last login:Today at 03:48:58 pm
  • Designated spam hunter
Re: Mame Outputs and Arduino
« Reply #8 on: March 28, 2021, 06:30:51 pm »
I am interested in this, is there any new topic about the subject?
I also need an example of the ini file and the arduino program to understand the commands, could be a simple one like digdug.
If you're working with a Windows system, check out MameHooker and the Mame InterOp SDK by HeadKaze and Howard Casto.
http://dragonking.arcadecontrols.com/static.php?page=aboutmamehooker
http://dragonking.arcadecontrols.com/static.php?page=aboutInterOp

If you're working with a Linux system, check out Meduza's LEDSpicer.
https://sourceforge.net/p/ledspicer/wiki/Home/


Scott

white_ghost

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 20
  • Last login:Today at 02:49:54 am
Re: Mame Outputs and Arduino
« Reply #9 on: March 29, 2021, 07:56:37 am »
hello
I have absolutely no time to take care of this project
but here is an example for digdug game

to see what outputs Mame sends (in windowed mode)
mame.exe digdug -window -output console
you should see in console led0 = 0 led0 = 1 alternatively when you insert coin P1
you should see in console led1 = 0 led1 = 1 alternatively when you insert coin P2

to let sumo detects outputs
launch sumo then
mame.exe digdug -window -output windows
insert coins P1 P2, play a little, exit
this part is important because Mame sends outputs in real time and we don't know what Mame sends until it sends

digdug.ini is now created and you can edit this file to suit your needs

original digdug ini file

[digdug]
constantforce=200
rumblemagnitude=40000
friction=200
damper=200
inertie=200
spring=200
[listitem]
led0=none
led1=none
Orientation(\\.\DISPLAY1)=none

-------------

edited digdug ini file

[digdug]
constantforce=200
rumblemagnitude=40000
friction=200
damper=200
inertie=200
spring=200
[listitem]
led0=led
led1=led
Orientation(\\.\DISPLAY1)=none

--------------------

led1=led
means
when in game led1 is switching on, the arduino receives =L101 (state=1, lamp=01)
when in game led1 is switching off, the arduino receives =L001 (state=0, lamp=01)

led0=led
means
when in game led0 is switching on, the arduino receives =L100 (state=1, lamp=00)
when in game led0 is switching off, the arduino receives =L000 (state=0, lamp=00)

--------------------

you can directly assign the output you want on arduino

[digdug]
constantforce=200
rumblemagnitude=40000
friction=200
damper=200
inertie=200
spring=200
[listitem]
led0=lamp3
led1=lamp5
Orientation(\\.\DISPLAY1)=none

led1=lamp5
means
when in game led1 is switching on, the arduino receives =L105 (state=1, lamp=05)
when in game led1 is switching off, the arduino receives =L005 (state=0, lamp=05)

led0=lamp3
means
when in game led0 is switching on, the arduino receives =L103 (state=1, lamp=03)
when in game led0 is switching off, the arduino receives =L003 (state=0, lamp=03)

-----------------

edit your arduino sketch to your needs, taking count of state and lamp number, mod you hardware connected to your arduino

connect your arduino, program it with your sketch
launch sumo (check com port)
then launch the game in full screen (or in windowed mode if you need to debug)
mame.exe digdug -output windows


Gonx

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 2
  • Last login:March 30, 2021, 04:13:12 pm
  • I want to build my own arcade controls!
Re: Mame Outputs and Arduino
« Reply #10 on: March 30, 2021, 04:12:54 pm »
Thanks for your help

Britxpatusa

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 3
  • Last login:April 14, 2024, 02:24:12 pm
  • I want to build my own arcade controls!
Re: Mame Outputs and Arduino
« Reply #11 on: May 13, 2021, 04:16:57 pm »
Hello,
I see you have said you have no tie but hoping you can answer a question:-)
Do you know if any lightgun games output? I have a setup using Dof/DOFLinx for RGB matirx effects. I would like to display "hit" - "miss" when playing a lightgun game....just wondering it this would be possible?
thanks for reading!


hello
I have absolutely no time to take care of this project
but here is an example for digdug game

to see what outputs Mame sends (in windowed mode)
mame.exe digdug -window -output console
you should see in console led0 = 0 led0 = 1 alternatively when you insert coin P1
you should see in console led1 = 0 led1 = 1 alternatively when you insert coin P2

to let sumo detects outputs
launch sumo then
mame.exe digdug -window -output windows
insert coins P1 P2, play a little, exit
this part is important because Mame sends outputs in real time and we don't know what Mame sends until it sends

digdug.ini is now created and you can edit this file to suit your needs

original digdug ini file

[digdug]
constantforce=200
rumblemagnitude=40000
friction=200
damper=200
inertie=200
spring=200
[listitem]
led0=none
led1=none
Orientation(\\.\DISPLAY1)=none

-------------

edited digdug ini file

[digdug]
constantforce=200
rumblemagnitude=40000
friction=200
damper=200
inertie=200
spring=200
[listitem]
led0=led
led1=led
Orientation(\\.\DISPLAY1)=none

--------------------

led1=led
means
when in game led1 is switching on, the arduino receives =L101 (state=1, lamp=01)
when in game led1 is switching off, the arduino receives =L001 (state=0, lamp=01)

led0=led
means
when in game led0 is switching on, the arduino receives =L100 (state=1, lamp=00)
when in game led0 is switching off, the arduino receives =L000 (state=0, lamp=00)

--------------------

you can directly assign the output you want on arduino

[digdug]
constantforce=200
rumblemagnitude=40000
friction=200
damper=200
inertie=200
spring=200
[listitem]
led0=lamp3
led1=lamp5
Orientation(\\.\DISPLAY1)=none

led1=lamp5
means
when in game led1 is switching on, the arduino receives =L105 (state=1, lamp=05)
when in game led1 is switching off, the arduino receives =L005 (state=0, lamp=05)

led0=lamp3
means
when in game led0 is switching on, the arduino receives =L103 (state=1, lamp=03)
when in game led0 is switching off, the arduino receives =L003 (state=0, lamp=03)

-----------------

edit your arduino sketch to your needs, taking count of state and lamp number, mod you hardware connected to your arduino

connect your arduino, program it with your sketch
launch sumo (check com port)
then launch the game in full screen (or in windowed mode if you need to debug)
mame.exe digdug -output windows

white_ghost

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 20
  • Last login:Today at 02:49:54 am
Re: Mame Outputs and Arduino
« Reply #12 on: May 14, 2021, 02:39:42 am »
Hi,
I don't think this sort of output exists
if game devoloppers haven't integrate this feature in their software, you can't easily do this.

the only way to do that, would be to make an asm mod of rom games. in other world, very hard and time consuming (study each dissassembled games, find the right spot (asm routine) of the hit miss, hijack this routine to your own subroutine to output (and only if any free slot in game hardware - "output driver" - exist), then return to the normal program.).

as far I know, only outrun has game mod in real deluxe cab made by a hacker (adding a fan whose speed changes with the speed in game to feel the breath in the hair). 

another solution, would be to make your own software, to read memory in live when game is running (ie, find offset of score, and offset of button trigger and with a smart logic (score change && trigger=hit, no score change && trigger=miss)), then you can make an output event