mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-02 21:53:07 +02:00
Update to v106r51 release.
byuu says: Changelog: - added `Emulator::Interface::connected(uint port) -> uint device;` - higan, bsnes: updated emulators to use the new Emulator::Interface::connected() function - hiro: fixed Object::cast<T> finally So, Emulator::Interface::connected() solves two annoying problems at the same time. First, on first run of the emulator when the settings file is blank, it will retrieve the default "sane" device ID, which is usually a gamepad for a controller port, or nothing for an expansion/extension port. Second, if you were to select a multi-port device, like the NES Four Score, the core will set the other port to the Four Score device as well, and the GUIs query connected() right after any call to connect(), so it gets updated without needing a system for the emulation core to send messages alerting the GUI of changes.
This commit is contained in:
@@ -15,6 +15,12 @@
|
||||
template<typename T, typename... P> Name(T* parent, P&&... p) : Name() { \
|
||||
if(parent) (*parent)->append(*this, std::forward<P>(p)...); \
|
||||
} \
|
||||
template<typename T> auto cast() -> T { \
|
||||
if(auto pointer = dynamic_cast<typename T::internalType*>(data())) { \
|
||||
if(auto shared = pointer->instance.acquire()) return T(shared); \
|
||||
} \
|
||||
return T(); \
|
||||
} \
|
||||
auto enabled(bool recursive = false) const { return self().enabled(recursive); } \
|
||||
auto focused() const { return self().focused(); } \
|
||||
auto font(bool recursive = false) const { return self().font(recursive); } \
|
||||
@@ -52,13 +58,6 @@
|
||||
struct Object : sObject {
|
||||
DeclareSharedObject(Object)
|
||||
using internalType = mObject;
|
||||
|
||||
template<typename T> auto cast() -> T {
|
||||
if(auto pointer = dynamic_cast<typename T::internalType*>(data())) {
|
||||
if(auto shared = pointer->instance.acquire()) return T(shared);
|
||||
}
|
||||
return T();
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user