Open MrDemocracy opened 7 years ago
2.4GHz is used for everything from cordless phones to bluetooth to Wi-Fi. You can't tell it to do arbitrary encoding/decoding on the raw signal though--that's per protocol on the NIC itself. So yes, it is that hard to communicate with a real GBA.
However, between instances of the emulator, this has been planned since 2014: https://endrift.com/mgba/bugs/show_bug.cgi?id=166
I feel like emulator <-> physical hardware linking could maybe be doable with a microcontroller talking to the GBA over link serial and to the computer via USB serial. But it would definitely require additional hardware of some sort, and appropriate drivers for mgba to handle the USB device would be required. Would definitely be an interesting project though.
Yes, but it would be a project that is not mGBA.
I've made some progress on this front (between instances of the emulator), over here: https://github.com/iracigt/mgba/tree/feature/RFU. Currently I have emulated the wireless adapter enough to enter the Pokemon FireRed/LeafGreen Union Room, see attached for example. Currently no multiplayer functionality works, just the bare minimum for a single adapter. The foundation is there though. Before moving forward, I'd like to know more about the existing plans for network multiplayer support and if maintaining compatibility with VBA is a goal.
Network multiplayer is going to use a framework (called mNP) that I've not quite started on yet (although I do plan to start it as soon as I finish the feature I'm currently working on) that will provide a means of synchronizing multiple instances of the emulator. However, this is only needed due to the synchronous nature of the communication over the link cable. As I understand it, the wireless adapter is (and must be) asynchronous, so the framework I'm going to write may not be the best approach for this. But since it will include server selection comms too, at some point, extending it to allow async communication might be worthwhile.
That said, for now, it might be useful to create a temporary protocol and replacing it with mNP later. For testing purposes, VBA-compatible for now might be useful, but only if VBA's protocol is sensible. And given VBA's track record, that may not be the case.
Pretty sure it's not the case that VBA's is sensible (sorry guys, good reverse engineering work, but the code never got refreshed). Its all SMFL and that would introduce yet another dependency and require bridging to C++. You are correct that the wireless adapter is inherently asynchronous and makes no guarantees about timing. I was thinking about the possibility of just using plain old sockets for now, with each platform providing a unified socket interface. I think it would be great if all instances of the emulator were network clients connecting to a central server. That would eliminate the need for port forwarding and make it easier to connect with friends across multiple devices. The costs and complexity associated with set something like that up may be prohibitive, however. In the mean time, I'll press forward with a custom protocol for POSIX first. Later we can migrate to mNP.
PS: +1 for code quality! mGBA's code is clean and consistent and has made the work so far much easier.
Please note, instead of using plain old BSD sockets, use the Socket interface in mgba-util/socket.h, which is a shim for different socket implementations based on which OS you're on.
Don't know if this is still actively being explored, but this issue definitely gets a +1 from me.
Is there any documentation of the GBA<->adapter protocol somewhere? I'm contemplating a hardware device for linking through the internet (with a central server).
What about emulator to emulator? Who actually has a game boy adapter and two gba's lying around but would getting two emulators to communicate via some type of bluetooth or a global lobby work easier?
Is GBA Wireless Adapter still planned for support for mGBA?
If it weren't this would have been closed. mNP is still planned (and a release blocker for 1.0) but as this is a single person project I haven't managed to get to it yet.
not sure if this is documented anywhere from an emulation perspective but some Pokemon Speedrunners have been testing timing advantages on console vs emu and Pokemon Emerald has this weird thing where having the adapter inserted on console reduces lag during door transitions by upwards of 10 frames - see attached Full_Emmy_Loads.pdf would be interested if this effect would be emulatable
Interesting. That's probably related to a phenomenon I discovered but was using to "break" Game Boy Player features on hardware, but I'd need to take a closer look.
Not really related to this thread but this is the closest thing to a discussion about this device I could find on the open internet. I see @iracigt's fork has some code to emulate this device, but it omits a lot of details it can get away with because it's an emulator. I'm wondering if anyone's written any protocol docs for this device?
GBATEK has some minimal documentation on it, but it's pretty lacking.
Nice. It's enough to answer a couple of the questions I had, though it'd be nice to see it more complete one day.
You may find this document from denopqrihg (author of the VBA-M wireless adapter code) helpful. I can't find the original file online anymore, so I've uploaded my copy here:
https://gist.github.com/iracigt/50b3a857e4d82c2c11d0dd5f84ecac6b
Wireless adapters have been successfully emulated on gpSP for libretro. https://github.com/davidgfnet/gpsp For more documentation: https://www.davidgf.net/2024/01/13/gba-wireless-adapter/
Have anyone ever thought about linking a Real GameBoy Advance with an Emulator? In theory it should be possible if you have the right software and hardware. According to NWiki (Nintendo Wiki), the Wireless Adapter, that you can use to link with, uses a Motorola chip that communicates on the 2.4Ghz wavelength, witch is the same frequency as every wifi card in your computer uses. I couldn't imagine it being that hard for the emulator to pick up the signal from the GameBoy Advance