Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
#117077 03/25/20 10:44 AM
Joined: Mar 2020
Posts: 7
K
Member
OP Offline
Member
K
Joined: Mar 2020
Posts: 7
Hi,

Introduction:
After several years on Megadrive side, I recently get hooked by the lil' Wonderswan.
I was looking for a way to homebrew develop on it and unfortunalty, no dedicated emulator include debug feature.
So I moved to MAME, since it include a full debugger and GFX Viewer.
Unfortunately, the GFX Viewer part isn't present, like most of the CONS system it seems.
And so began my journey on MAME driver update.
I must say, sorry, that it was VERY difficult to start and while I was about to stop, I finally was able to add GFX Viewer support.
and so I'm currently improve it step by step....


What is done
GFX Viewer for WS Classic
use of LOGMasked
(available on my MAME fork, wswan branch at https://github.com/KanedaFr/mame/tree/wswan)

What is in progress
Serial link support

My main reason to post of this forum is to be sure I do it the right way and, if interested, understand how to post my update to main branch, to allow any other people to use it.
I hope it's alright with the guidelines and that I will be able to at last give somethink back to MAME, after so many years using it for playing, hacking, etc....

Joined: Mar 2020
Posts: 7
K
Member
OP Offline
Member
K
Joined: Mar 2020
Posts: 7
Serial:

On the Wonderswan, you can connect on serial port
- a cable link (2 player support)
- a wonderwave (IR)
- a digimon connector
- a gps
- a sonar
- a mobilegate
....

How MAME allows to select what is connected to a port ?


I'm currently adding cable link support (using socket, similar to Sega Model1/2/32 driver), and so I'd like to know how to activate it ....

Joined: May 2009
Posts: 2,119
Likes: 152
J
Very Senior Member
Offline
Very Senior Member
J
Joined: May 2009
Posts: 2,119
Likes: 152
Please do not use sockets directly, those are for communicating with the outside world.

MAME uses "slot devices" for things that allow you to connect multiple things to a port. I would advise looking at the contents of src/devices/bus/rs232/ for inspiration.

Joined: Mar 2001
Posts: 17,005
Likes: 94
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,005
Likes: 94
I think they *do* want to communicate with the outside world. MAME has existing abstractions for that though.

Joined: Mar 2020
Posts: 7
K
Member
OP Offline
Member
K
Joined: Mar 2020
Posts: 7
Exactly, I'd like to be able to play at 2 players using 2 MAME, on same machine or not. It's why my code is based on socket.

I added

/bus/wswan/serial.cpp

with
Code
class ws_serial_device : public device_t
...
    required_device<ws_cable_link_device> m_cable_link;


class ws_cable_link_device : public device_t



it's required_device that's bug me

of course if comm_localhost/comm_remotehost aren't defined at commandLine, it won't work but I wonder how i could let the player choose to activate it or not...
I doubt adding an option on commandLine, specific to one driver is expected....

Joined: Mar 2020
Posts: 7
K
Member
OP Offline
Member
K
Joined: Mar 2020
Posts: 7
It seems I found a way to do it : using device_slot_interface
This way user could select device connected on serial port using MAME options

Is it the right way to do it ?

Joined: Nov 2016
Posts: 69
Likes: 47
P
Member
Offline
Member
P
Joined: Nov 2016
Posts: 69
Likes: 47
Yes, slot devices are the right way to do it, that's what Just Desserts mentioned above. But per R. Belmont's comment, MAME already has a way to do what you're asking, using the BITBANGER device and related support. You can look into how that's connected to the RS-232 null modem as an example, but in principle it allows you to transmit and receive arbitrary streams of data through sockets on the host, without having to implement your own network code (and the various operating system dependencies that entails).

To experiment, you can activate this function from the command line on any driver which implements an RS-232 port by adding arguments as follows:

Code
-<port_name> null_modem -bitbngr socket.<address>:<port>

where <port_name> is whatever the driver calls its serial port, and <address> and <port> are the IP address and port number of the socket you want to use.

In your case, if the link isn't RS-232, you can still follow the same approach to leverage BITBANGER for yourself.

Last edited by pmackinlay; 03/27/20 06:54 AM.
Joined: Feb 2004
Posts: 2,477
Likes: 170
Very Senior Member
Offline
Very Senior Member
Joined: Feb 2004
Posts: 2,477
Likes: 170
The TI-82 and TI-85 calculators use non-RS232 communications and can talk between MAME instances over sockets. It’s implemented using device_slot_interface. Cooked and raw communication over the socket is supported. Try following that example?

Joined: Mar 2020
Posts: 7
K
Member
OP Offline
Member
K
Joined: Mar 2020
Posts: 7
Just Desserts : sorry! I didn't realize the already point me to the right anwser frown I thought you were talking about using socket or not.

pmackinlay, Vas Crabb : I found the bitbanger solution while Googling, on TI82 related page but for some reason I didn't find it on command line... I thought it was since replaced by comm_localhost/comm_remotehost

so what the difference / benetifs of bitbanger vs comm_localhost/comm_remotehost ?
At this time, I successfully send data (TX), I have to fix some part of my receive code (RX) but should I move to bitbanger first ?

I'll try using device_slot after that, based on TI82 or NES example

thanks!!!!

Joined: Mar 2020
Posts: 7
K
Member
OP Offline
Member
K
Joined: Mar 2020
Posts: 7
I'm still working on my project.

For some reason, MAME quits without message when my 2 sessions connects.
I tested with a MAME session and some kind of socket server, it works (at least the server receive data).

Is there any way to make MAME more verbose, to diagnose the real reason of this raw crash ?

The only thing I found is that on my socket server, if i close the socket just after receiving first byte, MAME crashes the same way...

any hint is welcome....

Page 1 of 2 1 2

Link Copied to Clipboard
Who's Online Now
2 members (AJR, 1 invisible), 58 guests, and 4 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,189
Posts120,324
Members5,044
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com