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 Hooker Serial  (Read 2725 times)

0 Members and 1 Guest are viewing this topic.

gareth_iowc

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 33
  • Last login:October 04, 2022, 03:27:37 am
  • I want to build my own arcade controls!
Mame Hooker Serial
« on: December 14, 2019, 12:21:06 pm »
Hi All,

I'm looking for some more information on using mame hooker to send commands via the serial port as i would like to stick with my current setup.

I've been using the M2Pac project to drive my model 2 wheel and lamps.

The lamp output data is sent to the Arduino using a prolific PL2303HX serial adaptor.

The Serial data sent is -

Code: [Select]
[14/12/2019 15:42:51] Written data (COM5)
82 20                                             ‚               
[14/12/2019 15:42:51] Written data (COM5)
82 40                                             ‚@             
[14/12/2019 15:42:51] Written data (COM5)
82 80                                             ‚€             
[14/12/2019 15:42:52] Written data (COM5)
82 04                                             ‚.             
[14/12/2019 15:42:52] Written data (COM5)
82 08                                             ‚.             
[14/12/2019 15:42:52] Written data (COM5)
82 10                                             ‚.   


In mame hooker how would I choose the serial port as currently it does not show up in supported devices?

Thanks

 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:March 25, 2024, 08:10:48 pm
  • ...
Re: Mame Hooker Serial
« Reply #1 on: December 15, 2019, 07:20:27 am »
FYI, Howard and some of the Driving Cab subforum regulars often don't see posts in the Main Forum.
You're better off posting these type questions in Software or Driving Cab subforums.

Not a whole lot of people in the emulation community utilize outputs, except for those who are into the driving and gun games.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:March 16, 2024, 05:59:16 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Mame Hooker Serial
« Reply #2 on: December 15, 2019, 02:06:44 pm »
A com port isn't going to show up in supported devices because it isn't a device... it's a port.  I mean I could list all the com ports on your computer, but it'd be kind of silly considering what you really want to know is if a device connected to your com port is working and there's no real way for me to test for that.

Did I make the file editor for mamehooker for nothing?  Not being smart, just asking because nobody seems to ever bother checking it. 

First have the game running in windowed mode along with mamehooker.  Double click on the mamehooker icon in the task bar of windows to bring up the debug window.  Once you see outputs go ahead and select "Script Editor" and "Edit INI for Parent Rom"  Now you'll be inside the ini for the game.  Put the cursor after the "=" in "Mame Start" and select "Add Command."  Scroll Down until you see "com port open" and click ok.  You'll get some options for the port, baud rate and such... so go ahead and alter those to your liking and click "Done".  that will open a serial line when the game starts.  You'll want it to close when the game ends, so go ahead and go down to "mamestop", and this time add a "com port close" command.  Now for any of the outputs you'll want to add a, you guessed it, "com port write" command.  When done you'll have something resembling this:

[General]
MameStart=cmo 1 baud=9600_parity=N_data=8_stop=1
MameStop=cmc 1
StateChange=
OnRotate=
OnPause=
[Output]
lamp1=cmw 1 Hello_World
[KeyStates]
RefreshTime=

Now what I will say is you might have issues sending commas, but go ahead and try it.  You'll have to restart the game for things to take effect as obviously the game is already running and thus mamestart never gets called to open the serial connection. 

gareth_iowc

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 33
  • Last login:October 04, 2022, 03:27:37 am
  • I want to build my own arcade controls!
Re: Mame Hooker Serial
« Reply #3 on: December 15, 2019, 03:22:40 pm »
Hi Howard,

Thank you for the information.

Sorry, Although mame hooker appeared to be working ok I hadn't really looked at the editor because I was getting the following error -
 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:March 16, 2024, 05:59:16 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Mame Hooker Serial
« Reply #4 on: December 15, 2019, 03:53:29 pm »
Run mamehooker as administrator and see fi it fixes the error, if not:

Find that ocx and download it, register it via regsvr32, and then start using mamehooker.

This should help:

https://en.wikipedia.org/wiki/Regsvr32


gareth_iowc

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 33
  • Last login:October 04, 2022, 03:27:37 am
  • I want to build my own arcade controls!
Re: Mame Hooker Serial
« Reply #5 on: December 16, 2019, 04:13:22 pm »
Hi Howard,

Got the editor working now and it's great :)

Here are my settings -

Code: [Select]
[General]
MameStart=cmo 5 baud=38400_parity=N_data=8_stop=1
MameStop=cmc 5
StateChange=
OnRotate=
OnPause=
[KeyStates]
RefreshTime=
[Output]
LampStart=0x00 0x04
LampView1=0x00 0x08
LampView2=0x00 0x10
LampView3=0x00 0x20
LampView4=0x00 0x40
LampLeader=0x00 0x80
RawDrive=
RawLamps=

Using a serial port monitor I can see mame hooker opens a serial connection but I see no data transmitted.

Using the test mode tool I used the command "cmw 5 0x00 0x10" but had unexpected results.

Is mame hooker able to send hex values?


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:March 16, 2024, 05:59:16 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Mame Hooker Serial
« Reply #6 on: December 16, 2019, 08:44:56 pm »
Right now it's setup to send strings (text data).  Normally that'd be fine as any hex value has an ascii equivalent, but it looks like you are trying to send two values, which it can't do and it would be difficult to send the ascii character for 0. 

You do understand that if you are trying to send separate on/off commands that the command needs to be sent for each state right? So if 0x00 is off and 0x04 is one it'd look like this:

lamp0=cmw 5 0x00|cmw 5 0x04

Like I said though, it'd have to be ascii characters.

Did you look at the tutorials on the website?

I probably need to add a hex data mode now that people are actually using some of these diy methods I included.  I had started a release this summer but got sidetracked.  I'm looking at the code for something unrelated right now so maybe I can squeak a release out before xmas. 

gareth_iowc

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 33
  • Last login:October 04, 2022, 03:27:37 am
  • I want to build my own arcade controls!
Re: Mame Hooker Serial
« Reply #7 on: December 17, 2019, 08:59:36 am »
 Ah, that could be a problem as I need to send a 2 byte packet.

The setup i've had over a year is m2pac designed by BigPanik and i have been using alongside modern wheels for my daughter to use, but she always asks why the lamps don't work.

When boomslang released his output blaster that worked with mamehooker, I thought it was a great time to see if I can make it work without modifying the existing setup.

So the first byte is driveboard data and the second lamp. I'm not worried about using the ffb at this time.

0x04 - start
0x08 - vr1
0x10 - vr2
0x20 - vr3
0x40 - vr4
0x80 - leader

the data must be sent as a 2 byte packet or the results are incorrect.

Yes I did take a look at the guides but as you say there wasn't anything on hex.

TBH once i saw fix it felix jr i got very side tracked





Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:March 16, 2024, 05:59:16 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Mame Hooker Serial
« Reply #8 on: December 17, 2019, 04:35:50 pm »
That's a beast man.  You need to post your setup over in driving and racing.  I added a hex function last night but it's untested.  Honestly I forgot where I left off this summer and I have a lot of things going on in my personal life.  Stand by and I'll see what I can do. 

gareth_iowc

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 33
  • Last login:October 04, 2022, 03:27:37 am
  • I want to build my own arcade controls!
Re: Mame Hooker Serial
« Reply #9 on: December 18, 2019, 03:09:56 pm »
Amazing thank you very much :)

Yeah ok, I'll start a thread on the build. it was a lot of stress... i mean fun haha. I'll dig out the photos

gareth_iowc

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 33
  • Last login:October 04, 2022, 03:27:37 am
  • I want to build my own arcade controls!
Re: Mame Hooker Serial
« Reply #10 on: January 12, 2020, 02:36:10 pm »
Hi Howard,

Do you have a version where I can test the hex function?

:)

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19399
  • Last login:March 16, 2024, 05:59:16 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Mame Hooker Serial
« Reply #11 on: January 13, 2020, 01:34:23 am »
I had some stuff come up this weekend... I'll see if I can get something ready by next weekend.