GValiente / butano

Modern C++ high level GBA engine

Repository from Github https://github.comGValiente/butanoRepository from Github https://github.comGValiente/butano

[Request] Support wireless adapter for `bn::link` API

copyrat90 opened this issue · comments

Looks like LinkUniversal.hpp has been added to gba-link-connection, which you can use to support both link cable and the wireless adapter.
It would be nice to update to this instead of current LinkConnection.h

Since I don't have multiple wireless adapters for testing and they're too niche to be interesting to me, for now I'm not going to support them.

What I'm interested in is to know if it is possible to use modern LinkConnection with Butano without having to modify internal Butano code. Have you tried?

LinkConnection.h has been renamed to LinkCable.hpp, and looks like some API has been changed (for example I can't find LinkResponse in new API).
So I believe we need to change some code in bn_hw_link.cpp.
I haven't done this myself.

In my opinion, if you decide to put effort to accommodate the API change of the new LinkCable.hpp, it would be better to update it to LinkUniversal.hpp instead.

I mean using modern LinkConnection without touching/using existing bn::link implementation.

No, I haven't tried that either.

9724f7a and ddcf441 should allow to use the latest version of LinkConnection without changing current implementation.

I just confirmed that you can use newer gba-link-connection sources without editing Butano source.

Although you need to override some ISRs and manually enable them via bn::hw::*:

linkUniversal = /* ... */ ;

bn::memory::set_dma_enabled(false);
bn::hw::irq::set_isr(bn::hw::irq::id::SERIAL, LINK_UNIVERSAL_ISR_SERIAL);
bn::hw::irq::set_isr(bn::hw::irq::id::TIMER1, LINK_UNIVERSAL_ISR_TIMER);
bn::core::set_vblank_callback(LINK_UNIVERSAL_ISR_VBLANK);

bn::hw::irq::enable(bn::hw::irq::id::SERIAL);
bn::hw::irq::enable(bn::hw::irq::id::TIMER1);
linkUniversal->activate();