Modes (menu system abstractions)

This is as far as I’ve gotten:
I hooked up debugging and inexplicably, popMode() keeps calling mode_activate in the BCSelectBladeMode instead of exiting the mode stack, regardless of the previous_ poiniter being set correctly (so we know nothing is further back because we’re at the base)

Initial Push into BCSelectBladeMode:

10:31:06.295 -> Pushing mode: current_mode = 0x536879172, new mode = 0x536898920
10:31:06.295 -> pushMode: previous_ set to 0x536879172
10:31:06.295 -> BCSelectBladeMode: Entering mode_activate, onreturn=0

Mode Stack at this point:
current_mode: 0x536898920 → BCSelectBladeMode.
current_mode->previous_: 0x536879172 → Likely SaberBCButtons.
Push into BCChangeBladeLengthBlade1:

10:31:09.017 -> Pushing mode: current_mode = 0x536898920, new mode = 0x536897004
10:31:09.017 -> pushMode: previous_ set to 0x536898920

Mode Stack at this point:
current_mode: 0x536897004 → BCChangeBladeLengthBlade1.
current_mode->previous_: 0x536898920 → BCSelectBladeMode.
Pop from BCChangeBladeLengthBlade1:

10:31:15.048 -> popMode: Starting...
10:31:15.048 -> popMode: Deactivating current_mode = 0x536897004, previous_ = 0x536898920

At this point, popMode() switches back to BCSelectBladeMode and activates it with onreturn = true:

10:31:15.083 -> popMode: Activating previous mode = 0x536898920
10:31:15.083 -> BCSelectBladeMode: Entering mode_activate, onreturn=1

BCSelectBladeMode Handles onreturn = true:

10:31:15.083 -> BCSelectBladeMode: onreturn is true, calling popMode()...

BCSelectBladeMode calls popMode() again, moving back to the previous mode (SaberBCButtons):

10:31:15.083 -> popMode: Deactivating current_mode = 0x536898920, previous_ = 0x536879172
10:31:15.083 -> popMode: Switching to previous mode
10:31:15.083 -> popMode: Activating previous mode = 0x536879172

Unexpected Behavior: Despite popMode() transitioning to SaberBCButtons (0x536879172), we see this next:

10:31:15.083 -> BCSelectBladeMode: Returned from popMode(), continuing flow...
10:31:15.083 -> ** Editing blade length.
10:31:15.083 -> ** Highlighting blade: 1

This indicates that BCSelectBladeMode::mode_activate is being re-entered, despite current_mode now being SaberBCButtons.