| 
									
										
										
										
											2015-09-26 16:39:47 -04:00
										 |  |  | // Copyright 2015 Dolphin Emulator Project
 | 
					
						
							|  |  |  | // Licensed under GPLv2+
 | 
					
						
							|  |  |  | // Refer to the license.txt file included.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-20 11:33:47 +01:00
										 |  |  | #include "Common/Common.h"
 | 
					
						
							| 
									
										
										
										
											2015-09-26 16:39:47 -04:00
										 |  |  | #include "Common/CommonFuncs.h"
 | 
					
						
							|  |  |  | #include "Common/Logging/Log.h"
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | #include "Common/MsgHandler.h"
 | 
					
						
							| 
									
										
										
										
											2015-09-26 16:39:47 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef _WIN32
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | #define _assert_msg_(_t_, _a_, _fmt_, ...)                                                         \
 | 
					
						
							|  |  |  |   if (!(_a_))                                                                                      \ | 
					
						
							|  |  |  |   {                                                                                                \ | 
					
						
							|  |  |  |     if (!PanicYesNo(_fmt_, __VA_ARGS__))                                                           \ | 
					
						
							|  |  |  |       Crash();                                                                                     \ | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-09-26 16:39:47 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | #define _dbg_assert_msg_(_t_, _a_, _msg_, ...)                                                     \
 | 
					
						
							|  |  |  |   if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_))                                      \ | 
					
						
							|  |  |  |   {                                                                                                \ | 
					
						
							|  |  |  |     ERROR_LOG(_t_, _msg_, __VA_ARGS__);                                                            \ | 
					
						
							|  |  |  |     if (!PanicYesNo(_msg_, __VA_ARGS__))                                                           \ | 
					
						
							|  |  |  |       Crash();                                                                                     \ | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-09-26 16:39:47 -04:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | #define _assert_msg_(_t_, _a_, _fmt_, ...)                                                         \
 | 
					
						
							|  |  |  |   if (!(_a_))                                                                                      \ | 
					
						
							|  |  |  |   {                                                                                                \ | 
					
						
							|  |  |  |     if (!PanicYesNo(_fmt_, ##__VA_ARGS__))                                                         \ | 
					
						
							|  |  |  |       Crash();                                                                                     \ | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-09-26 16:39:47 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | #define _dbg_assert_msg_(_t_, _a_, _msg_, ...)                                                     \
 | 
					
						
							|  |  |  |   if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_))                                      \ | 
					
						
							|  |  |  |   {                                                                                                \ | 
					
						
							|  |  |  |     ERROR_LOG(_t_, _msg_, ##__VA_ARGS__);                                                          \ | 
					
						
							|  |  |  |     if (!PanicYesNo(_msg_, ##__VA_ARGS__))                                                         \ | 
					
						
							|  |  |  |       Crash();                                                                                     \ | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-09-26 16:39:47 -04:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | #define _assert_(_a_)                                                                              \
 | 
					
						
							|  |  |  |   _assert_msg_(MASTER_LOG, _a_,                                                                    \ | 
					
						
							|  |  |  |                _trans("An error occurred.\n\n  Line: %d\n  File: %s\n\nIgnore and continue?"),     \ | 
					
						
							|  |  |  |                __LINE__, __FILE__) | 
					
						
							| 
									
										
										
										
											2015-09-26 16:39:47 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  | #define _dbg_assert_(_t_, _a_)                                                                     \
 | 
					
						
							|  |  |  |   if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG)                                                \ | 
					
						
							|  |  |  |   _assert_(_a_) |