forked from eden-emu/eden
		
	Fix Mario Kart 8 Deluxe control applet freeze (#149)
Not limited to MK8D, this commit may fix games that commonly crash on the controller applet and possibly others as well. This new approach prevents other games from breaking with this fix. Co-authored-by: MaranBr <maranbr@outlook.com> Reviewed-on: eden-emu/eden#149
This commit is contained in:
		
							parent
							
								
									78fc80376b
								
							
						
					
					
						commit
						7eb5710f35
					
				
					 2 changed files with 9 additions and 3 deletions
				
			
		|  | @ -26,7 +26,7 @@ void Applet::UpdateSuspensionStateLocked(bool force_message) { | ||||||
|     // Remove any forced resumption.
 |     // Remove any forced resumption.
 | ||||||
|     lifecycle_manager.RemoveForceResumeIfPossible(); |     lifecycle_manager.RemoveForceResumeIfPossible(); | ||||||
| 
 | 
 | ||||||
|     // Check if we're runnable.
 | 	const bool update_requested_focus_state = lifecycle_manager.UpdateRequestedFocusState(); | ||||||
|     const bool curr_activity_runnable = lifecycle_manager.IsRunnable(); |     const bool curr_activity_runnable = lifecycle_manager.IsRunnable(); | ||||||
|     const bool prev_activity_runnable = is_activity_runnable; |     const bool prev_activity_runnable = is_activity_runnable; | ||||||
|     const bool was_changed = curr_activity_runnable != prev_activity_runnable; |     const bool was_changed = curr_activity_runnable != prev_activity_runnable; | ||||||
|  | @ -36,6 +36,7 @@ void Applet::UpdateSuspensionStateLocked(bool force_message) { | ||||||
|             process->Suspend(false); |             process->Suspend(false); | ||||||
|         } else { |         } else { | ||||||
|             process->Suspend(true); |             process->Suspend(true); | ||||||
|  | 			lifecycle_manager.RequestResumeNotification(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         is_activity_runnable = curr_activity_runnable; |         is_activity_runnable = curr_activity_runnable; | ||||||
|  | @ -47,8 +48,7 @@ void Applet::UpdateSuspensionStateLocked(bool force_message) { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Signal if the focus state was changed or the process state was changed.
 |     // Signal if the focus state was changed or the process state was changed.
 | ||||||
|     if (lifecycle_manager.UpdateRequestedFocusState() || was_changed || force_message) { |     if (update_requested_focus_state || was_changed || force_message) { | ||||||
| 		lifecycle_manager.RequestResumeNotification(); |  | ||||||
|         lifecycle_manager.SignalSystemEventIfNeeded(); |         lifecycle_manager.SignalSystemEventIfNeeded(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -101,6 +101,12 @@ Result ILibraryAppletAccessor::PushInData(SharedPointer<IStorage> storage) { | ||||||
| 
 | 
 | ||||||
| Result ILibraryAppletAccessor::PopOutData(Out<SharedPointer<IStorage>> out_storage) { | Result ILibraryAppletAccessor::PopOutData(Out<SharedPointer<IStorage>> out_storage) { | ||||||
|     LOG_DEBUG(Service_AM, "called"); |     LOG_DEBUG(Service_AM, "called"); | ||||||
|  | 	if (auto caller_applet = m_applet->caller_applet.lock(); caller_applet) { | ||||||
|  | 		Event m_system_event = caller_applet->lifecycle_manager.GetSystemEvent(); | ||||||
|  | 		m_system_event.Signal(); | ||||||
|  | 		caller_applet->lifecycle_manager.RequestResumeNotification(); | ||||||
|  | 		m_system_event.Clear(); | ||||||
|  | 	} | ||||||
|     R_RETURN(m_broker->GetOutData().Pop(out_storage.Get())); |     R_RETURN(m_broker->GetOutData().Pop(out_storage.Get())); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 MaranBr
						MaranBr