hidbus/ringcon: Fixed cleanup, this also fixed a crash.

This commit is contained in:
yellows8 2020-08-20 13:28:10 -04:00
parent 9a1e3aeb47
commit bcc0f86aa3
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 2 additions and 0 deletions

View File

@ -95,6 +95,7 @@ Result ringconCreate(RingCon *c, HidControllerID id) {
void ringconClose(RingCon *c) { void ringconClose(RingCon *c) {
if (c->bus_initialized) { if (c->bus_initialized) {
c->bus_initialized = false;
// Official sw uses hidbusDisableJoyPollingReceiveMode here, but that's redundant since hidbusEnableExternalDevice with flag=false uses that automatically. // Official sw uses hidbusDisableJoyPollingReceiveMode here, but that's redundant since hidbusEnableExternalDevice with flag=false uses that automatically.
hidbusEnableExternalDevice(c->handle, false, 0x20); hidbusEnableExternalDevice(c->handle, false, 0x20);
hidbusFinalize(c->handle); hidbusFinalize(c->handle);

View File

@ -279,6 +279,7 @@ Result hidbusFinalize(HidbusBusHandle handle) {
if (R_SUCCEEDED(rc)) rc = _hidbusInBusHandleResIdNoOut(&srv, handle, 4); // Finalize if (R_SUCCEEDED(rc)) rc = _hidbusInBusHandleResIdNoOut(&srv, handle, 4); // Finalize
eventClose(&entry->event); eventClose(&entry->event);
memset(&entry->handle, 0, sizeof(entry->handle));
_hidbusSharedmemExit(); _hidbusSharedmemExit();
} }