Home Page
Posted By: KanedaFr Wonderswan driver update - 03/25/20 10:44 AM

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....
Posted By: KanedaFr Re: Wonderswan driver update - 03/25/20 10:48 AM

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 ....
Posted By: Just Desserts Re: Wonderswan driver update - 03/25/20 03:09 PM
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.
Posted By: R. Belmont Re: Wonderswan driver update - 03/25/20 05:13 PM
I think they *do* want to communicate with the outside world. MAME has existing abstractions for that though.
Posted By: KanedaFr Re: Wonderswan driver update - 03/26/20 05:54 PM
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


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....
Posted By: KanedaFr Re: Wonderswan driver update - 03/27/20 01:38 AM
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 ?
Posted By: pmackinlay Re: Wonderswan driver update - 03/27/20 06:52 AM
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:

-<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.
Posted By: Vas Crabb Re: Wonderswan driver update - 03/27/20 07:56 AM
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?
Posted By: KanedaFr Re: Wonderswan driver update - 03/27/20 09:34 AM
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

Posted By: KanedaFr Re: Wonderswan driver update - 04/13/20 08:42 PM
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....
Posted By: KanedaFr Re: Wonderswan driver update - 04/15/20 09:56 AM
I made a huge mistake : to think socket was lost every time socket->read doesn't return error::none

It's now fixed and data exchange works
moving to next step
© Forums