| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#ifdef _WIN32 |
| 7 |
#include <optional> |
| 8 |
#endif |
| 9 |
#include <string> |
| 10 |
|
| 11 |
#ifdef __APPLE__ |
| 12 |
#include "Common/CommonTypes.h" |
| 13 |
#endif |
| 14 |
|
| 15 |
#ifndef _WIN32 |
| 16 |
|
| 17 |
|
| 18 |
#define Crash() \ |
| 19 |
{ \ |
| 20 |
__builtin_trap(); \ |
| 21 |
} |
| 22 |
|
| 23 |
#else |
| 24 |
|
| 25 |
#define strcasecmp _stricmp |
| 26 |
#define strncasecmp _strnicmp |
| 27 |
#define unlink _unlink |
| 28 |
#define vscprintf _vscprintf |
| 29 |
|
| 30 |
|
| 31 |
#define fseeko _fseeki64 |
| 32 |
#define ftello _ftelli64 |
| 33 |
#define atoll _atoi64 |
| 34 |
#define stat _stat64 |
| 35 |
#define fstat _fstat64 |
| 36 |
#define fileno _fileno |
| 37 |
|
| 38 |
extern "C" { |
| 39 |
__declspec(dllimport) void __stdcall DebugBreak(void); |
| 40 |
} |
| 41 |
#define Crash() \ |
| 42 |
{ \ |
| 43 |
DebugBreak(); \ |
| 44 |
} |
| 45 |
#endif |
| 46 |
|
| 47 |
namespace Common |
| 48 |
{ |
| 49 |
|
| 50 |
const char* StrErrorWrapper(int error, char* buffer, std::size_t length); |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
std::string StrerrorString(int error); |
| 55 |
std::string LastStrerrorString(); |
| 56 |
|
| 57 |
#ifdef _WIN32 |
| 58 |
|
| 59 |
|
| 60 |
std::string GetLastErrorString(); |
| 61 |
|
| 62 |
|
| 63 |
std::string GetWin32ErrorString(unsigned long error_code); |
| 64 |
|
| 65 |
|
| 66 |
std::optional<std::wstring> GetModuleName(void* hInstance); |
| 67 |
#endif |
| 68 |
|
| 69 |
#ifdef __APPLE__ |
| 70 |
struct MacOSVersion |
| 71 |
{ |
| 72 |
s64 major; |
| 73 |
s64 minor; |
| 74 |
s64 patch; |
| 75 |
}; |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
MacOSVersion GetMacOSVersion(); |
| 80 |
#endif |
| 81 |
} |