mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Fix showing color console if debugger attached on windows.
This commit is contained in:
		
							parent
							
								
									e26ceabfd1
								
							
						
					
					
						commit
						b6239a3dab
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -25,7 +25,14 @@ void ToggleConsole() { | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|     FILE* temp; |     FILE* temp; | ||||||
|     if (UISettings::values.show_console) { |     if (UISettings::values.show_console) { | ||||||
|         if (AllocConsole()) { |         BOOL alloc_console_res = AllocConsole(); | ||||||
|  |         DWORD last_error = 0; | ||||||
|  |         if (!alloc_console_res) { | ||||||
|  |             last_error = GetLastError(); | ||||||
|  |         } | ||||||
|  |         // If the windows debugger already opened a console, calling AllocConsole again
 | ||||||
|  |         // will cause ERROR_ACCESS_DENIED. If that's the case assume a console is open.
 | ||||||
|  |         if (alloc_console_res || last_error == ERROR_ACCESS_DENIED) { | ||||||
|             // The first parameter for freopen_s is a out parameter, so we can just ignore it
 |             // The first parameter for freopen_s is a out parameter, so we can just ignore it
 | ||||||
|             freopen_s(&temp, "CONIN$", "r", stdin); |             freopen_s(&temp, "CONIN$", "r", stdin); | ||||||
|             freopen_s(&temp, "CONOUT$", "w", stdout); |             freopen_s(&temp, "CONOUT$", "w", stdout); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue