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