PCE: Fixed IO port read behavior when no controller is plugged in

This commit is contained in:
Sour 2024-03-10 22:14:38 +09:00
parent 202231e104
commit 1f1b7c1db2
2 changed files with 9 additions and 1 deletions

View file

@ -45,11 +45,19 @@ uint8_t PceControlManager::ReadInputPort()
SetInputReadFlag();
uint8_t result = 0;
bool hasController = false;
for(shared_ptr<BaseControlDevice>& device : _controlDevices) {
if(device->IsConnected()) {
result |= device->ReadRam(0);
hasController |= device->GetPort() == 0;
}
}
if(!hasController) {
//When no controller is connected, bottom 4 bits will be open bus
result |= 0x0F;
}
return result;
}

View file

@ -15,7 +15,7 @@ Latest development builds:
**macOS**: Builds aren't available for ARM Macs, see [COMPILING.md](COMPILING.md) to build it yourself. The macOS build still has a number of limitations (e.g no gamepad support).
**SteamOS**: Running Mesen through the Steam Deck's _Game Mode_ is possible with some caveats regarding rendering the UI.
<details open>
<details>
<summary>SteamOS instructions and caveats</summary>
<br>
Due to Gamescope (SteamOS' compositor) not handling Avalonia UI's popups very well (a [solution](https://github.com/AvaloniaUI/Avalonia/pull/14366) is available but [has been reverted due to other issues](https://github.com/AvaloniaUI/Avalonia/pull/14573)), Mesen's menus for settings are not working through Gamescope unless running Mesen [through running KDE Plasma's Desktop through a script](https://www.reddit.com/r/SteamDeck/comments/zqgx9g/desktop_mode_within_gaming_mode_updated_for_new/).