mirror of
https://github.com/gwdevhub/gMod.git
synced 2026-07-15 15:09:30 +00:00
72 lines
1.6 KiB
C++
72 lines
1.6 KiB
C++
#pragma once
|
|
|
|
// using HashType = DWORD32;
|
|
using HashType = DWORD64;
|
|
|
|
struct HashTuple {
|
|
HashType crc32;
|
|
HashType crc64;
|
|
|
|
bool operator==(const HashTuple& other) const noexcept
|
|
{
|
|
return (other.crc32 == crc32) || (other.crc64 == crc64);
|
|
}
|
|
|
|
explicit operator bool() const noexcept
|
|
{
|
|
return crc32 != 0 || crc64 != 0;
|
|
}
|
|
|
|
explicit operator HashType() const noexcept
|
|
{
|
|
return crc32 ? crc32 : crc64;
|
|
}
|
|
};
|
|
|
|
struct TexEntry {
|
|
std::vector<BYTE> data{};
|
|
HashType crc_hash = 0; // hash value
|
|
std::string ext{};
|
|
};
|
|
|
|
struct TextureFileStruct {
|
|
std::vector<BYTE> data{};
|
|
HashType crc_hash = 0; // hash value
|
|
};
|
|
|
|
inline void Message([[maybe_unused]] const char* format, ...)
|
|
{
|
|
#ifdef _DEBUG
|
|
// const HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
//[[maybe_unused]] const auto success = SetConsoleTextAttribute(hConsole, 0); // white
|
|
va_list args;
|
|
va_start(args, format);
|
|
vprintf(format, args);
|
|
va_end(args);
|
|
#endif
|
|
}
|
|
|
|
inline void Info([[maybe_unused]] const char* format, ...)
|
|
{
|
|
#ifdef _DEBUG
|
|
// const HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
//[[maybe_unused]] const auto success = SetConsoleTextAttribute(hConsole, 0); // white
|
|
va_list args;
|
|
va_start(args, format);
|
|
vprintf(format, args);
|
|
va_end(args);
|
|
#endif
|
|
}
|
|
|
|
inline void Warning([[maybe_unused]] const char* format, ...)
|
|
{
|
|
#ifdef _DEBUG
|
|
const HANDLE hConsole = GetStdHandle(STD_ERROR_HANDLE);
|
|
[[maybe_unused]] const auto success = SetConsoleTextAttribute(hConsole, 6); // yellow
|
|
va_list args;
|
|
va_start(args, format);
|
|
vfprintf(stderr, format, args);
|
|
va_end(args);
|
|
#endif
|
|
}
|