The Simple DirectMedia Library that is widely-used by many cross-platform games and part of the Steam Runtime now has better support for handling more mouse button events under Wayland.
Last week was a bug report over supporting more mouse buttons than five. While some mice end up binding their extra mouse buttons to keyboard keys, some mice such as when configured via Libratbag+Piper can map them to higher key press input event codes. Theoretically, allowing up to 48 key press input events in total.



Gaming peripherals usually have internal memory for settings, yeah.
When you edit what a button does, it actually changes the input sent by the device in the firmware, so your mouse is likely just pretending to be a keyboard for those keys, and just internally running macros for the autoclicks.
It’s why you can set things up, and then close the config software.