mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 04:04:18 +02:00
fix issues
fix timeout loop, fixed drift issues, fixed infinite rumble, fixed gamecube controller adapter taking over all ports, require assigning a virtual controller port specifically to the gamecube controller adapter, and block inputs from gamecube controller while settings menu (f10 menu) is open
This commit is contained in:
1 parent
f1c2b60df1
commit
251529d66e
8 files changed
+161
-77
No files matched your search
@@ -60,6 +60,9 @@ struct RuntimeUserConfig {
|
||||
// comma-separated SDL-style physical button names ("south", or
|
||||
// "dpad_up,left_shoulder") as values; pressing either bound button counts.
|
||||
std::array<std::optional<std::string>, 12> controllerButtons;
|
||||
// One-based physical WUP-028 adapter port assigned to each game port.
|
||||
// Zero or a missing value means the adapter does not own that game port.
|
||||
std::array<uint32_t, 4> gameCubeAdapterPorts{};
|
||||
};
|
||||
|
||||
namespace RuntimeConfigFile {
|
||||
@@ -323,6 +326,12 @@ inline RuntimeUserConfig ParseConfigDocument(const toml::value& document) {
|
||||
config.controllerButtons[index] =
|
||||
FindConfigValue<std::string>(document, "controller", buttonKeys[index]);
|
||||
}
|
||||
for (size_t index = 0; index < config.gameCubeAdapterPorts.size(); ++index) {
|
||||
const std::string key = "adapter_port_" + std::to_string(index + 1);
|
||||
if (auto value = FindConfigUint(document, "controller", key); value && *value <= 4) {
|
||||
config.gameCubeAdapterPorts[index] = *value;
|
||||
}
|
||||
}
|
||||
|
||||
config.widescreen = FindConfigValue<bool>(document, "video", "widescreen");
|
||||
config.windowPosX = FindConfigInt(document, "video", "window_x");
|
||||
@@ -586,6 +595,19 @@ inline bool SetControllerButton(size_t index, std::string value) {
|
||||
return WriteSetting("controller", kControllerButtonKeys[index], FormatString(value));
|
||||
}
|
||||
|
||||
inline int GameCubeAdapterPort(size_t gamePort) {
|
||||
if (gamePort >= Get().gameCubeAdapterPorts.size()) return -1;
|
||||
const uint32_t physicalPort = Get().gameCubeAdapterPorts[gamePort];
|
||||
return physicalPort >= 1 && physicalPort <= 4 ? static_cast<int>(physicalPort - 1) : -1;
|
||||
}
|
||||
|
||||
inline bool SetGameCubeAdapterPort(size_t gamePort, int physicalPort) {
|
||||
if (gamePort >= Mutable().gameCubeAdapterPorts.size() || physicalPort < -1 || physicalPort >= 4) return false;
|
||||
const uint32_t storedPort = physicalPort < 0 ? 0u : static_cast<uint32_t>(physicalPort + 1);
|
||||
Mutable().gameCubeAdapterPorts[gamePort] = storedPort;
|
||||
return WriteSetting("controller", "adapter_port_" + std::to_string(gamePort + 1), std::to_string(storedPort));
|
||||
}
|
||||
|
||||
inline bool SetAudioVolume(float value) {
|
||||
value = std::clamp(value, 0.0f, 1.0f);
|
||||
Mutable().audioVolume = value;
|
||||
|
||||
Reference in new issue
Block a user