This commit is contained in:
m 2025-01-25 21:01:53 -06:00
parent a55f5874af
commit 15ec6cc13f
4 changed files with 71 additions and 0 deletions

View File

@ -1972,4 +1972,18 @@ namespace game
char pad_0040[432];
};
static_assert(sizeof(XZone) == 496);
struct WeaponDef
{
union
{
const char* szInternalName;
const char* name;
};
};
struct XModel
{
const char* name; // 0
};
}

View File

@ -23,6 +23,7 @@ namespace game
WEAK symbol<CodPlayMode()> Com_GetCurrentCoDPlayMode{0, 0x1404C9690};
WEAK symbol<void(float, float, int)> Com_SetSlowMotion{0, 0x1403D19B0};
WEAK symbol<void()> Com_Quit_f{0x1402F9390, 0x1403D08C0};
WEAK symbol<int(char* dest, int size, const char* fmt, ...)> Com_sprintf{0x0, 0x1404C97B0};
WEAK symbol<void(const char* cmdName, void (), cmd_function_s* allocedCmd)> Cmd_AddCommandInternal{0x1402EDDB0, 0x1403AF2C0};
WEAK symbol<void(int localClientNum, int controllerIndex, const char* text)> Cmd_ExecuteSingleCommand{0x1402EE350, 0x1403AF900};

View File

@ -176,4 +176,52 @@ namespace utils::string
return str;
}
bool is_numeric(const std::string& text)
{
return std::to_string(atoi(text.data())) == text;
}
bool find_lower(const std::string& a, const std::string& b)
{
return to_lower(a).find(to_lower(b)) != std::string::npos;
}
bool strstr_lower(const char* a, const char* b)
{
const char* a_ = a;
const char* b_ = b;
while (*a_ != '\0' && *b_ != '\0')
{
if (*b_ == '*' || std::tolower(*a_) == std::tolower(*b_))
{
b_++;
}
else
{
b_ = b;
}
a_++;
}
return *b_ == '\0';
}
void set_clipboard_data(const std::string& text)
{
const auto len = text.size() + 1;
const auto mem = GlobalAlloc(GMEM_MOVEABLE, len);
memcpy(GlobalLock(mem), text.data(), len);
GlobalUnlock(mem);
if (OpenClipboard(nullptr))
{
EmptyClipboard();
SetClipboardData(CF_TEXT, mem);
CloseClipboard();
}
}
}

View File

@ -95,4 +95,12 @@ namespace utils::string
std::wstring convert(const std::string& str);
std::string replace(std::string str, const std::string& from, const std::string& to);
bool is_numeric(const std::string& text);
bool find_lower(const std::string& a, const std::string& b);
bool strstr_lower(const char* a, const char* b);
void set_clipboard_data(const std::string& text);
}