wiimote: Clear used wiimotes on shutdown#228
Conversation
|
@Zarithya Somewhere within your last three merged PRs there seems to be a regression. Wii applications (I've tested the |
to be investigated first, because my builds work fine on my wii and dolphin... |
|
False alarm, sorry for the inconvenience. The problem is entirely in my machine. |
Actually, I was getting similar issues with devkitPPC r47 - downgrading to r46 fixed it. |
|
Turns out the addition of ca84f9d#diff-e1a91d721b2cdc2e35fd08cb1c80abc9890b0deeeca11b7b1d76d8826b4895f1R46 caused WPAD_MAX_DEVICES to become 6. MAX_WIIMOTES is 5 ( https://github.com/devkitPro/libogc/blob/master/wiiuse/io_wii.c#L16 ), which causes a heap buffer overrun when wiiuse_init initializes the 6th wiimote. By pure chance the linker placed the global It looks like |
Wiimotes were not being cleared from the active bitmask and were taking their own slots if WPAD was shutdown and reinit in the same app. This clears the active and used bitmasks, ensuring those slots are properly marked as not in use upon shutdown, and also adds in a check to ensure that the owner of a slot can always get it back.