mirror of
https://github.com/patchzyy/wiicompiled
synced 2026-09-11 09:25:05 -04:00
@@ -1,7 +1,4 @@
|
||||
#include "settings_overlay.h"
|
||||
#ifdef _WIN32
|
||||
#include "wup028_adapter.h"
|
||||
#endif
|
||||
#include "audio_backend.h"
|
||||
#include "controller_mapping_wizard.h"
|
||||
#include "game_graphics_options.h"
|
||||
@@ -313,41 +310,6 @@ void ApplyConfiguredMappings() {
|
||||
}
|
||||
}
|
||||
|
||||
void DrawGameCubeAdapterInfo() {
|
||||
// The official GameCube adapter is Windows-only (see wup028_adapter.cpp); on Linux/macOS,
|
||||
// Wup028Adapter is a permanently-disconnected stub, and SDL3 already exposes the same
|
||||
// hardware as a normal joystick, so this menu would only ever show "Searching" and four
|
||||
// perpetually-empty adapter ports - confusing clutter for a feature that can't do anything
|
||||
// on this platform. Skip it entirely rather than render a menu that never has content.
|
||||
#if defined(_WIN32)
|
||||
ImGui::Separator();
|
||||
if (!ImGui::BeginMenu("GameCube adapter info")) return;
|
||||
|
||||
const auto adapter = Wup028Adapter::GetInfo();
|
||||
const char* state = adapter.state == Wup028Adapter::ConnectionState::Connected
|
||||
? "Connected"
|
||||
: adapter.state == Wup028Adapter::ConnectionState::DriverError ? "Driver error"
|
||||
: "Searching";
|
||||
ImGui::Text("Status: %s", state);
|
||||
if (!adapter.deviceName.empty()) {
|
||||
ImGui::Text("Device: %s", adapter.deviceName.c_str());
|
||||
}
|
||||
ImGui::TextWrapped("%s", adapter.detail.c_str());
|
||||
if (adapter.state == Wup028Adapter::ConnectionState::Connected) {
|
||||
ImGui::Text("Poll rate: %.1f reports/s", adapter.pollRateHz);
|
||||
ImGui::Text("Endpoints: IN 0x%02X, OUT 0x%02X", adapter.inputEndpoint, adapter.outputEndpoint);
|
||||
for (size_t port = 0; port < adapter.ports.size(); ++port) {
|
||||
const uint8_t type = adapter.portStatus[port] & 0x30;
|
||||
const char* typeName = type == 0x10 ? "wired" : type == 0x20 ? "wireless" : "none";
|
||||
ImGui::Text("Adapter port %u: %s (type %s, raw 0x%02X)", static_cast<unsigned>(port + 1),
|
||||
adapter.ports[port] ? "Controller connected" : "Empty", typeName,
|
||||
adapter.portStatus[port]);
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DrawControllerSettings() {
|
||||
for (int port = 0; port < PAD_MAX_CONTROLLERS; ++port) {
|
||||
const std::string label = "Port " + std::to_string(port + 1);
|
||||
@@ -359,50 +321,10 @@ void DrawControllerSettings() {
|
||||
|
||||
ImGui::Separator();
|
||||
const uint32_t selectedGamePort = static_cast<uint32_t>(g_controllerPort);
|
||||
#if defined(_WIN32)
|
||||
const int adapterAssignment = Wup028Adapter::GetPortAssignment(selectedGamePort);
|
||||
if (adapterAssignment >= 0) {
|
||||
ImGui::Text("Assigned: GameCube adapter port %d", adapterAssignment + 1);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
const char* currentName = PADGetName(selectedGamePort);
|
||||
ImGui::Text("Assigned: %s", currentName != nullptr ? currentName : "None");
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
// Windows-only, same reasoning as DrawGameCubeAdapterInfo() above: on other platforms
|
||||
// adapterAssignment is always -1 and every port would always read "(empty)", so this submenu
|
||||
// would never have anything real to offer.
|
||||
if (ImGui::BeginMenu("Assign GameCube adapter port")) {
|
||||
if (ImGui::MenuItem("None", nullptr, adapterAssignment < 0)) {
|
||||
Wup028Adapter::SetPortAssignment(selectedGamePort, -1);
|
||||
RuntimeConfigFile::SetGameCubeAdapterPort(selectedGamePort, -1);
|
||||
}
|
||||
const auto adapter = Wup028Adapter::GetInfo();
|
||||
for (int physicalPort = 0; physicalPort < PAD_CHANMAX; ++physicalPort) {
|
||||
const std::string label = "Adapter port " + std::to_string(physicalPort + 1) +
|
||||
(adapter.ports[static_cast<size_t>(physicalPort)] ? " (connected)" : " (empty)");
|
||||
if (ImGui::MenuItem(label.c_str(), nullptr, adapterAssignment == physicalPort)) {
|
||||
for (uint32_t gamePort = 0; gamePort < PAD_CHANMAX; ++gamePort) {
|
||||
if (gamePort != selectedGamePort && Wup028Adapter::GetPortAssignment(gamePort) == physicalPort) {
|
||||
RuntimeConfigFile::SetGameCubeAdapterPort(gamePort, -1);
|
||||
}
|
||||
}
|
||||
PADClearPort(selectedGamePort);
|
||||
Wup028Adapter::SetPortAssignment(selectedGamePort, physicalPort);
|
||||
RuntimeConfigFile::SetGameCubeAdapterPort(selectedGamePort, physicalPort);
|
||||
g_configuredControllerIndices.fill(std::numeric_limits<int32_t>::min());
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
#endif
|
||||
const char* currentName = PADGetName(selectedGamePort);
|
||||
ImGui::Text("Assigned: %s", currentName != nullptr ? currentName : "None");
|
||||
if (ImGui::MenuItem("Unassign controller")) {
|
||||
PADClearPort(selectedGamePort);
|
||||
#if defined(_WIN32)
|
||||
Wup028Adapter::SetPortAssignment(selectedGamePort, -1);
|
||||
RuntimeConfigFile::SetGameCubeAdapterPort(selectedGamePort, -1);
|
||||
#endif
|
||||
g_configuredControllerIndices.fill(std::numeric_limits<int32_t>::min());
|
||||
}
|
||||
ImGui::Separator();
|
||||
@@ -410,9 +332,6 @@ void DrawControllerSettings() {
|
||||
const uint32_t controllerCount = PADCount();
|
||||
if (controllerCount == 0) {
|
||||
ImGui::TextDisabled("No controller connected");
|
||||
#if defined(_WIN32)
|
||||
DrawGameCubeAdapterInfo();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -421,10 +340,6 @@ void DrawControllerSettings() {
|
||||
const char* name = PADGetNameForControllerIndex(index);
|
||||
ImGui::PushID(static_cast<int>(index));
|
||||
if (ImGui::MenuItem(name != nullptr ? name : "Unknown controller")) {
|
||||
#if defined(_WIN32)
|
||||
Wup028Adapter::SetPortAssignment(selectedGamePort, -1);
|
||||
RuntimeConfigFile::SetGameCubeAdapterPort(selectedGamePort, -1);
|
||||
#endif
|
||||
PADSetPortForIndex(index, selectedGamePort);
|
||||
g_configuredControllerIndices.fill(std::numeric_limits<int32_t>::min());
|
||||
ApplyConfiguredMappings();
|
||||
@@ -438,9 +353,6 @@ void DrawControllerSettings() {
|
||||
PADButtonMapping* mappings = PADGetButtonMappings(static_cast<uint32_t>(g_controllerPort), &mappingCount);
|
||||
if (mappings == nullptr || mappingCount != PAD_BUTTON_COUNT) {
|
||||
ImGui::TextDisabled("Assign a controller to edit its buttons");
|
||||
#if defined(_WIN32)
|
||||
DrawGameCubeAdapterInfo();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -580,9 +492,6 @@ void DrawControllerSettings() {
|
||||
ImGui::TextUnformatted(kControllerButtons[i].label);
|
||||
ImGui::PopID();
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
DrawGameCubeAdapterInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DrawAudioSettings() {
|
||||
|
||||
Reference in New Issue
Block a user