mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -06:00
@ -9,28 +9,6 @@
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define ASSERT_MSG(_t_, _a_, _fmt_, ...) \
|
||||
do \
|
||||
{ \
|
||||
if (!(_a_)) \
|
||||
{ \
|
||||
if (!PanicYesNo(_fmt_, __VA_ARGS__)) \
|
||||
Crash(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG_ASSERT_MSG(_t_, _a_, _msg_, ...) \
|
||||
do \
|
||||
{ \
|
||||
if (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG && !(_a_)) \
|
||||
{ \
|
||||
ERROR_LOG(_t_, _msg_, __VA_ARGS__); \
|
||||
if (!PanicYesNo(_msg_, __VA_ARGS__)) \
|
||||
Crash(); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define ASSERT_MSG(_t_, _a_, _fmt_, ...) \
|
||||
do \
|
||||
{ \
|
||||
@ -44,14 +22,16 @@
|
||||
#define DEBUG_ASSERT_MSG(_t_, _a_, _msg_, ...) \
|
||||
do \
|
||||
{ \
|
||||
if (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG && !(_a_)) \
|
||||
if constexpr (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \
|
||||
{ \
|
||||
ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \
|
||||
if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \
|
||||
Crash(); \
|
||||
if (!(_a_)) \
|
||||
{ \
|
||||
ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \
|
||||
if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \
|
||||
Crash(); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define ASSERT(_a_) \
|
||||
do \
|
||||
@ -64,6 +44,6 @@
|
||||
#define DEBUG_ASSERT(_a_) \
|
||||
do \
|
||||
{ \
|
||||
if (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \
|
||||
if constexpr (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \
|
||||
ASSERT(_a_); \
|
||||
} while (0)
|
||||
|
@ -183,7 +183,7 @@ static bool GetModuleVersion(const wchar_t* name, Version* version)
|
||||
if (!data_len)
|
||||
return false;
|
||||
std::vector<u8> block(data_len);
|
||||
if (!GetFileVersionInfoW(path->c_str(), handle, data_len, block.data()))
|
||||
if (!GetFileVersionInfoW(path->c_str(), 0, data_len, block.data()))
|
||||
return false;
|
||||
void* buf;
|
||||
UINT buf_len;
|
||||
|
@ -98,7 +98,7 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& directorie
|
||||
};
|
||||
for (const auto& directory : directories)
|
||||
{
|
||||
const fs::path directory_path = StringToPath(directory);
|
||||
fs::path directory_path = StringToPath(directory);
|
||||
if (fs::is_directory(directory_path)) // Can't create iterators for non-existant directories
|
||||
{
|
||||
if (recursive)
|
||||
@ -125,9 +125,11 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& directorie
|
||||
// std::filesystem uses the OS separator.
|
||||
constexpr fs::path::value_type os_separator = fs::path::preferred_separator;
|
||||
static_assert(os_separator == DIR_SEP_CHR || os_separator == '\\', "Unsupported path separator");
|
||||
if (os_separator != DIR_SEP_CHR)
|
||||
if constexpr (os_separator != DIR_SEP_CHR)
|
||||
{
|
||||
for (auto& path : result)
|
||||
std::replace(path.begin(), path.end(), '\\', DIR_SEP_CHR);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -600,7 +600,7 @@ std::string GetCurrentDir()
|
||||
if (!dir)
|
||||
{
|
||||
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", LastStrerrorString().c_str());
|
||||
return nullptr;
|
||||
return "";
|
||||
}
|
||||
std::string strDir = dir;
|
||||
free(dir);
|
||||
@ -621,10 +621,15 @@ std::string CreateTempDir()
|
||||
return "";
|
||||
|
||||
GUID guid;
|
||||
CoCreateGuid(&guid);
|
||||
TCHAR tguid[40];
|
||||
StringFromGUID2(guid, tguid, 39);
|
||||
tguid[39] = 0;
|
||||
if (FAILED(CoCreateGuid(&guid)))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
OLECHAR tguid[40]{};
|
||||
if (!StringFromGUID2(guid, tguid, _countof(tguid)))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
std::string dir = TStrToUTF8(temp) + "/" + TStrToUTF8(tguid);
|
||||
if (!CreateDir(dir))
|
||||
return "";
|
||||
|
@ -1470,7 +1470,7 @@ u32* GekkoDisassembler::DoDisassembly(bool big_endian)
|
||||
break;
|
||||
|
||||
case 30:
|
||||
switch (in & 0x1c)
|
||||
switch ((in >> 2) & 0x7)
|
||||
{
|
||||
case 0:
|
||||
rld(in, "icl", 0); // rldicl
|
||||
|
@ -32,39 +32,6 @@ bool MsgAlert(bool yes_no, MsgType style, const char* format, ...)
|
||||
void SetEnableAlert(bool enable);
|
||||
} // namespace Common
|
||||
|
||||
#if defined(_WIN32) && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL == 1)
|
||||
#define SuccessAlert(format, ...) \
|
||||
Common::MsgAlert(false, Common::MsgType::Information, format, __VA_ARGS__)
|
||||
|
||||
#define PanicAlert(format, ...) \
|
||||
Common::MsgAlert(false, Common::MsgType::Warning, format, __VA_ARGS__)
|
||||
|
||||
#define PanicYesNo(format, ...) \
|
||||
Common::MsgAlert(true, Common::MsgType::Warning, format, __VA_ARGS__)
|
||||
|
||||
#define AskYesNo(format, ...) Common::MsgAlert(true, Common::MsgType::Question, format, __VA_ARGS__)
|
||||
|
||||
#define CriticalAlert(format, ...) \
|
||||
Common::MsgAlert(false, Common::MsgType::Critical, format, __VA_ARGS__)
|
||||
|
||||
// Use these macros (that do the same thing) if the message should be translated.
|
||||
|
||||
#define SuccessAlertT(format, ...) \
|
||||
Common::MsgAlert(false, Common::MsgType::Information, format, __VA_ARGS__)
|
||||
|
||||
#define PanicAlertT(format, ...) \
|
||||
Common::MsgAlert(false, Common::MsgType::Warning, format, __VA_ARGS__)
|
||||
|
||||
#define PanicYesNoT(format, ...) \
|
||||
Common::MsgAlert(true, Common::MsgType::Warning, format, __VA_ARGS__)
|
||||
|
||||
#define AskYesNoT(format, ...) \
|
||||
Common::MsgAlert(true, Common::MsgType::Question, format, __VA_ARGS__)
|
||||
|
||||
#define CriticalAlertT(format, ...) \
|
||||
Common::MsgAlert(false, Common::MsgType::Critical, format, __VA_ARGS__)
|
||||
|
||||
#else
|
||||
#define SuccessAlert(format, ...) \
|
||||
Common::MsgAlert(false, Common::MsgType::Information, format, ##__VA_ARGS__)
|
||||
|
||||
@ -95,4 +62,3 @@ void SetEnableAlert(bool enable);
|
||||
|
||||
#define CriticalAlertT(format, ...) \
|
||||
Common::MsgAlert(false, Common::MsgType::Critical, format, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
@ -247,7 +247,7 @@ bool SDCardCreate(u64 disk_size /*in MB*/, const std::string& filename)
|
||||
if (!write_sector(file, s_fsinfo_sector))
|
||||
goto FailWrite;
|
||||
|
||||
if (BACKUP_BOOT_SECTOR > 0)
|
||||
if constexpr (BACKUP_BOOT_SECTOR > 0)
|
||||
{
|
||||
if (!write_empty(file, BACKUP_BOOT_SECTOR - 2))
|
||||
goto FailWrite;
|
||||
|
@ -6,9 +6,6 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
|
||||
namespace Common
|
||||
|
@ -254,7 +254,7 @@ std::string Timer::GetDateTimeFormatted(double time)
|
||||
|
||||
#ifdef _WIN32
|
||||
wchar_t tmp[32] = {};
|
||||
wcsftime(tmp, sizeof(tmp), L"%x %X", localTime);
|
||||
wcsftime(tmp, std::size(tmp), L"%x %X", localTime);
|
||||
return WStringToUTF8(tmp);
|
||||
#else
|
||||
char tmp[32] = {};
|
||||
|
Reference in New Issue
Block a user