mirror of
				https://github.com/Zelda64Recomp/Zelda64Recomp.git
				synced 2025-10-30 08:03:03 +00:00 
			
		
		
		
	Handle controller up events even while binding inputs to avoid spamming the bind button
This commit is contained in:
		
							parent
							
								
									aef0bf50ea
								
							
						
					
					
						commit
						8cf381005e
					
				
					 2 changed files with 13 additions and 7 deletions
				
			
		|  | @ -287,6 +287,10 @@ bool sdl_event_filter(void* userdata, SDL_Event* event) { | |||
|     case SDL_EventType::SDL_DROPCOMPLETE: | ||||
|         recompui::drop_files(DropState.files_dropped); | ||||
|         break; | ||||
|     case SDL_EventType::SDL_CONTROLLERBUTTONUP: | ||||
|         // Always queue button up events to avoid missing them during binding.
 | ||||
|         recompui::queue_event(*event); | ||||
|         break; | ||||
|     default: | ||||
|         queue_if_enabled(event); | ||||
|         break; | ||||
|  |  | |||
|  | @ -585,6 +585,15 @@ void draw_hook(RT64::RenderCommandList* command_list, RT64::RenderFramebuffer* s | |||
|     while (recompui::try_deque_event(cur_event)) { | ||||
|         bool context_capturing_input = recompui::is_context_capturing_input(); | ||||
|         bool context_capturing_mouse = recompui::is_context_capturing_mouse(); | ||||
| 
 | ||||
|         // Handle up button events even when input is disabled to avoid missing them during binding.
 | ||||
|         if (cur_event.type == SDL_EventType::SDL_CONTROLLERBUTTONUP) { | ||||
|             int sdl_key = cont_button_to_key(cur_event.cbutton); | ||||
|             if (sdl_key == latest_controller_key_pressed) { | ||||
|                 latest_controller_key_pressed = SDLK_UNKNOWN; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (!recomp::all_input_disabled()) { | ||||
|             bool is_mouse_input = false; | ||||
|             // Implement some additional behavior for specific events on top of what RmlUi normally does with them.
 | ||||
|  | @ -630,13 +639,6 @@ void draw_hook(RT64::RenderCommandList* command_list, RT64::RenderFramebuffer* s | |||
|                 cont_interacted = true; | ||||
|                 break; | ||||
|             } | ||||
|             case SDL_EventType::SDL_CONTROLLERBUTTONUP: { | ||||
|                 int sdl_key = cont_button_to_key(cur_event.cbutton); | ||||
|                 if (sdl_key == latest_controller_key_pressed) { | ||||
|                     latest_controller_key_pressed = SDLK_UNKNOWN; | ||||
|                 } | ||||
|                 break; | ||||
|             } | ||||
|             case SDL_EventType::SDL_KEYDOWN: | ||||
|                 non_mouse_interacted = true; | ||||
|                 kb_interacted = true; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Mr-Wiseguy
						Mr-Wiseguy