ares: support disconnecting controller from emulated device

Selecting "nothing" for a controller port from the UI only consistently
blocked input from the host, and it did not reliably do the extra work
required to actually disconnect the controller from the perspective of
the emulated device.

This was handled only by the MD and N64 cores, but now all cores are
standardized on the disconnection method originally implemented for MD.
このコミットが含まれているのは:
invertego 2023-02-12 23:17:14 -08:00 committed by Luke Usher
コミット a63d20c0d1
14個のファイルの変更13行の追加3行の削除

ファイルの表示

@ -10,6 +10,7 @@ auto ControllerPort::load(Node::Object parent) -> void {
port->setType("Controller");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Gamepad"});
}

ファイルの表示

@ -10,6 +10,7 @@ auto ControllerPort::load(Node::Object parent) -> void {
port->setType("Controller");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Gamepad"});
}

ファイルの表示

@ -10,6 +10,7 @@ auto ControllerPort::load(Node::Object parent) -> void {
port->setType("Controller");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Gamepad"});
}

ファイルの表示

@ -9,6 +9,7 @@ auto ExpansionPort::load(Node::Object parent) -> void {
port->setType("Expansion");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Family Keyboard"});
}

ファイルの表示

@ -10,6 +10,7 @@ auto ControllerPort::load(Node::Object parent) -> void {
port->setType("Controller");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Gamepad", "Light Phaser", "Paddle", "Sports Pad", "MD Control Pad", "MD Fighting Pad", "Mega Mouse"});
}

ファイルの表示

@ -10,6 +10,7 @@ auto ControllerPort::load(Node::Object parent) -> void {
port->setType("Controller");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Gamepad","Arkanoid Vaus Paddle"});
}

ファイルの表示

@ -12,6 +12,7 @@ auto ControllerPort::load(Node::Object parent) -> void {
port->setType("Controller");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Gamepad", "Mouse"});
}
@ -25,7 +26,6 @@ auto ControllerPort::save() -> void {
}
auto ControllerPort::allocate(string name) -> Node::Peripheral {
device = {};
if(name == "Gamepad") device = new Gamepad(port);
if(name == "Mouse" ) device = new Mouse(port);
if(device) return device->node;

ファイルの表示

@ -9,6 +9,7 @@ auto CardSlot::load(Node::Object parent) -> void {
port->setType("Memory Card");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Memory Card"});
}

ファイルの表示

@ -10,6 +10,7 @@ auto ControllerPort::load(Node::Object parent) -> void {
port->setType("Controller");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Arcade Stick"});
}

ファイルの表示

@ -9,6 +9,7 @@ auto ControllerPort::load(Node::Object parent) -> void {
port->setType("Controller");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Gamepad", "Avenue Pad 6", "Multitap"});
}

ファイルの表示

@ -12,6 +12,7 @@ auto PeripheralPort::load(Node::Object parent) -> void {
port->setType(type);
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
if(type == "Controller") {
port->setSupported({"Digital Gamepad"});
}

ファイルの表示

@ -10,6 +10,7 @@ auto ControllerPort::load(Node::Object parent) -> void {
port->setType("Controller");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({
"Gamepad",
"Justifier",

ファイルの表示

@ -10,6 +10,7 @@ auto ControllerPort::load(Node::Object parent) -> void {
port->setType("Controller");
port->setHotSwappable(true);
port->setAllocate([&](auto name) { return allocate(name); });
port->setDisconnect([&] { device.reset(); });
port->setSupported({"Gamepad"});
}

ファイルの表示

@ -401,8 +401,6 @@ auto Presentation::loadEmulator() -> void {
peripheralItem.onActivate([=] {
auto port = peripheralItem.attribute<ares::Node::Port>("port");
port->disconnect();
port->allocate(peripheralItem.text());
port->connect();
});
peripheralGroup.append(peripheralItem);
}