@@ -16,17 +16,14 @@ class ExitToHBMenu(Exception):
1616 pass
1717
1818
19- # modified AnsiMenu.poll_input to resume marker position.
20- # I feel like I could have done this in a better way... but this works
19+ # modified AnsiMenu.poll_input to resume marker position and have quicker movement options
2120def poll_input (self ):
2221 if self .firstrun :
2322 # todo: do this differently to prevent delay when placing marker near the bottom of the screen
2423 self .console .write (b" " + bytes ("\n " * self .selected_idx + "\r >\r " , 'UTF-8' ))
2524 self .firstrun = False
2625 _nx .hid_scan_input ()
27- keys_down = _nx .hid_keys_down (self .CONTROLLER_P1_AUTO ) # | _nx.hid_keys_held(self.CONTROLLER_P1_AUTO)
28- # todo: also move marker if button is held or maybe another way to move faster.
29- # I think I need to wait on pyNX for this.
26+ keys_down = _nx .hid_keys_down (self .CONTROLLER_P1_AUTO )
3027
3128 if keys_down & self .KEY_A :
3229 return True
@@ -42,6 +39,24 @@ def poll_input(self):
4239 self .selected_idx += 1
4340 self .console .write (b" \n \r >\r " )
4441 self .console .flush ()
42+ elif keys_down & (1 << 14 ):
43+ if self .selected_idx < len (self .entries ) - 5 :
44+ self .selected_idx += 5
45+ self .console .write (b" \n \n \n \n \n \r >\r " )
46+ self .console .flush ()
47+ else :
48+ self .console .write (bytes ((" " + "\n " * ((len (self .entries ) - 1 ) - self .selected_idx ))+ "\r >\r " , "UTF-8" ))
49+ self .selected_idx = len (self .entries ) - 1
50+ self .console .flush ()
51+ elif keys_down & (1 << 12 ):
52+ if self .selected_idx > 5 :
53+ self .selected_idx -= 5
54+ self .console .write (b" \x1b [1A\x1b [1A\x1b [1A\x1b [1A\x1b [1A\r >\r " )
55+ self .console .flush ()
56+ else :
57+ self .console .write (bytes ((" " + "\x1b [1A" * self .selected_idx ) + "\r >\r " , "UTF-8" ))
58+ self .selected_idx = 0
59+ self .console .flush ()
4560
4661 return False
4762
0 commit comments