mirror of
https://github.com/patchzyy/wiicompiled
synced 2026-09-11 09:25:05 -04:00
remove WUP028 driver which is already handled by SDL3 on Linux
also restores automatic port assignment on non-Windows. This should be the default as https://github.com/patchzyy/Wiicompiled/pull/42 was never a necessary change
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#include "hle_stubs.h"
|
||||
#include "memory.h"
|
||||
#include "hle/controller_status_contract.h"
|
||||
#ifdef _WIN32
|
||||
#include "wup028_adapter.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
@@ -34,7 +36,9 @@ void WritePadStatus(uint32_t base, const PADStatus& status) {
|
||||
|
||||
extern "C" uint32_t PAD__Init_HLE()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
Wup028Adapter::Initialize();
|
||||
#endif
|
||||
return PADInit() ? 1u : 0u;
|
||||
}
|
||||
PPC_NATIVE_OVERRIDE(801AF2F0, PAD__Init_HLE, uint32_t, (), ());
|
||||
@@ -46,8 +50,9 @@ extern "C" uint32_t PAD__Read_HLE(uint32_t statusPtr)
|
||||
}
|
||||
|
||||
PADStatus statuses[PAD_CHANMAX]{};
|
||||
std::array<PADStatus, PAD_CHANMAX> adapterStatuses{};
|
||||
uint32_t rumbleMask = PADRead(statuses);
|
||||
#if defined(_WIN32)
|
||||
std::array<PADStatus, PAD_CHANMAX> adapterStatuses{};
|
||||
if (Wup028Adapter::Read(adapterStatuses) && !PADIsInputBlocked()) {
|
||||
for (uint32_t port = 0; port < PAD_CHANMAX; ++port) {
|
||||
if (adapterStatuses[port].err == PAD_ERR_NONE) {
|
||||
@@ -56,6 +61,7 @@ extern "C" uint32_t PAD__Read_HLE(uint32_t statusPtr)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
try {
|
||||
for (uint32_t i = 0; i < PAD_CHANMAX; ++i) {
|
||||
@@ -84,8 +90,12 @@ PPC_NATIVE_OVERRIDE(801AF1E4, PAD__Recalibrate_HLE, uint32_t, (uint32_t mask), (
|
||||
|
||||
extern "C" void PAD__ControlMotor_HLE(int32_t chan, uint32_t command)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
if (!Wup028Adapter::SetRumble(static_cast<uint32_t>(chan), command == PAD_MOTOR_RUMBLE)) {
|
||||
PADControlMotor(chan, command);
|
||||
}
|
||||
#else
|
||||
PADControlMotor(chan, command);
|
||||
#endif
|
||||
}
|
||||
PPC_NATIVE_OVERRIDE_VOID(801AF908, PAD__ControlMotor_HLE, (int32_t chan, uint32_t command), (chan, command));
|
||||
|
||||
@@ -1377,7 +1377,9 @@ int RuntimeMain(int argc, char** argv) {
|
||||
}
|
||||
aurora_set_frame_worker_wait_callback(ServiceGuestTimingDuringAuroraFrameWait);
|
||||
GxGuestWrite::InstallAuroraHooks();
|
||||
#if defined(_WIN32)
|
||||
Wup028Adapter::Initialize();
|
||||
#endif
|
||||
UpdateMkwDynamicAspectSurface(auroraInfo.windowSize.native_fb_width,
|
||||
auroraInfo.windowSize.native_fb_height);
|
||||
settings_overlay::InitializeRuntimeSettings();
|
||||
@@ -1419,7 +1421,9 @@ int RuntimeMain(int argc, char** argv) {
|
||||
// Shutdown fiber system
|
||||
Fiber::GuestFiberManager::Shutdown();
|
||||
WindowPlacementPersistence::Flush(true);
|
||||
#if defined(_WIN32)
|
||||
Wup028Adapter::Shutdown();
|
||||
#endif
|
||||
aurora_shutdown();
|
||||
SetRuntimeExitCodeImpl(0);
|
||||
ShutdownProcessTranscript();
|
||||
@@ -1437,7 +1441,9 @@ int RuntimeMain(int argc, char** argv) {
|
||||
SetRuntimeExitCodeImpl(1);
|
||||
Fiber::GuestFiberManager::Shutdown();
|
||||
WindowPlacementPersistence::Flush(true);
|
||||
#if defined(_WIN32)
|
||||
Wup028Adapter::Shutdown();
|
||||
#endif
|
||||
aurora_shutdown();
|
||||
ShutdownProcessTranscript();
|
||||
return 1;
|
||||
@@ -1449,7 +1455,9 @@ int RuntimeMain(int argc, char** argv) {
|
||||
SetRuntimeExitCodeImpl(1);
|
||||
Fiber::GuestFiberManager::Shutdown();
|
||||
WindowPlacementPersistence::Flush(true);
|
||||
#if defined(_WIN32)
|
||||
Wup028Adapter::Shutdown();
|
||||
#endif
|
||||
aurora_shutdown();
|
||||
ShutdownProcessTranscript();
|
||||
return 1;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#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,6 +315,12 @@ 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;
|
||||
|
||||
@@ -338,6 +346,7 @@ void DrawGameCubeAdapterInfo() {
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DrawControllerSettings() {
|
||||
@@ -351,13 +360,20 @@ 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 {
|
||||
} 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);
|
||||
@@ -381,10 +397,13 @@ void DrawControllerSettings() {
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
#endif
|
||||
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();
|
||||
@@ -392,7 +411,9 @@ void DrawControllerSettings() {
|
||||
const uint32_t controllerCount = PADCount();
|
||||
if (controllerCount == 0) {
|
||||
ImGui::TextDisabled("No controller connected");
|
||||
#if defined(_WIN32)
|
||||
DrawGameCubeAdapterInfo();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -401,8 +422,10 @@ 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();
|
||||
@@ -416,7 +439,9 @@ 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;
|
||||
}
|
||||
|
||||
@@ -556,7 +581,9 @@ void DrawControllerSettings() {
|
||||
ImGui::TextUnformatted(kControllerButtons[i].label);
|
||||
ImGui::PopID();
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
DrawGameCubeAdapterInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DrawAudioSettings() {
|
||||
|
||||
Reference in New Issue
Block a user