Skip to content
Permalink
Browse files

Clang format changes

  • Loading branch information...
BenCat07 committed May 20, 2019
1 parent 6ff1c25 commit 1c5d10ad802eb96fce372c3ae5f9ca18de21a8a9
@@ -31,5 +31,5 @@ SpacesInSquareBrackets: 'false'
Standard: Auto
TabWidth: '4'
UseTab: Never

AlignEscapedNewlines: Left
...

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -21,10 +21,11 @@ enum RasterizerFlags
NoHinting = 1 << 0, // Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes.
NoAutoHint = 1 << 1, // Disable auto-hinter.
ForceAutoHint = 1 << 2, // Indicates that the auto-hinter is preferred over the font's native hinter.
LightHinting = 1 << 3, // A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text.
MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output.
Bold = 1 << 5, // Styling: Should we artificially embolden the font?
Oblique = 1 << 6 // Styling: Should we slant the font, emulating italic style?
LightHinting = 1 << 3, // A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the
// pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text.
MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output.
Bold = 1 << 5, // Styling: Should we artificially embolden the font?
Oblique = 1 << 6 // Styling: Should we slant the font, emulating italic style?
};

IMGUI_API bool BuildFontAtlas(ImFontAtlas *atlas, unsigned int extra_flags = 0);

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -85,27 +85,27 @@ extern "C" typedef HSteamUser (*GetHSteamUser_t)();

void CreateInterfaces()
{
g_ICvar = BruteforceInterface<ICvar>("VEngineCvar", sharedobj::vstdlib());
g_IEngine = BruteforceInterface<IVEngineClient013>("VEngineClient", sharedobj::engine());
g_AppID = g_IEngine->GetAppID();
g_IEntityList = BruteforceInterface<IClientEntityList>("VClientEntityList", sharedobj::client());
g_ISteamClient = BruteforceInterface<ISteamClient>("SteamClient", sharedobj::steamclient(), 17);
g_IEventManager2 = BruteforceInterface<IGameEventManager2>("GAMEEVENTSMANAGER", sharedobj::engine(), 2);
g_IGameEventManager = BruteforceInterface<IGameEventManager>("GAMEEVENTSMANAGER", sharedobj::engine(), 1);
g_IBaseClient = BruteforceInterface<IBaseClientDLL>("VClient", sharedobj::client());
g_ITrace = BruteforceInterface<IEngineTrace>("EngineTraceClient", sharedobj::engine());
g_IInputSystem = BruteforceInterface<IInputSystem>("InputSystemVersion", sharedobj::inputsystem());
g_ICvar = BruteforceInterface<ICvar>("VEngineCvar", sharedobj::vstdlib());
g_IEngine = BruteforceInterface<IVEngineClient013>("VEngineClient", sharedobj::engine());
g_AppID = g_IEngine->GetAppID();
g_IEntityList = BruteforceInterface<IClientEntityList>("VClientEntityList", sharedobj::client());
g_ISteamClient = BruteforceInterface<ISteamClient>("SteamClient", sharedobj::steamclient(), 17);
g_IEventManager2 = BruteforceInterface<IGameEventManager2>("GAMEEVENTSMANAGER", sharedobj::engine(), 2);
g_IGameEventManager = BruteforceInterface<IGameEventManager>("GAMEEVENTSMANAGER", sharedobj::engine(), 1);
g_IBaseClient = BruteforceInterface<IBaseClientDLL>("VClient", sharedobj::client());
g_ITrace = BruteforceInterface<IEngineTrace>("EngineTraceClient", sharedobj::engine());
g_IInputSystem = BruteforceInterface<IInputSystem>("InputSystemVersion", sharedobj::inputsystem());

logging::Info("Initing SteamAPI");
GetHSteamPipe_t GetHSteamPipe = reinterpret_cast<GetHSteamPipe_t>(dlsym(sharedobj::steamapi().lmap, "SteamAPI_GetHSteamPipe"));
HSteamPipe sp = GetHSteamPipe();
HSteamPipe sp = GetHSteamPipe();
if (!sp)
{
logging::Info("Connecting to Steam User");
sp = g_ISteamClient->CreateSteamPipe();
}
GetHSteamUser_t GetHSteamUser = reinterpret_cast<GetHSteamUser_t>(dlsym(sharedobj::steamapi().lmap, "SteamAPI_GetHSteamUser"));
HSteamUser su = GetHSteamUser();
HSteamUser su = GetHSteamUser();
if (!su)
{
logging::Info("Connecting to Steam User");
@@ -78,30 +78,32 @@ AutoTauntListener listener;

InitRoutine init([]() {
g_IEventManager2->AddListener(&listener, "player_death", false);
EC::Register(EC::Shutdown, []() { g_IEventManager2->RemoveListener(&listener); }, "Shutdown_Autotaunt");
EC::Register(EC::CreateMove,
[]() {
if (prev_slot != -1 && CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && LOCAL_E->m_bAlivePlayer() && taunt_t.test_and_set(100))
{
if (in_taunt)
{
if (!HasCondition<TFCond_Taunting>(LOCAL_E))
{
hack::ExecuteCommand(format("slot", prev_slot + 1));
prev_slot = -1;
in_taunt = false;
}
else
taunt_t.update();
}
else
{
hack::ExecuteCommand("taunt");
in_taunt = true;
taunt_t.update();
}
}
},
"Autotaunt_CM");
EC::Register(
EC::Shutdown, []() { g_IEventManager2->RemoveListener(&listener); }, "Shutdown_Autotaunt");
EC::Register(
EC::CreateMove,
[]() {
if (prev_slot != -1 && CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && LOCAL_E->m_bAlivePlayer() && taunt_t.test_and_set(100))
{
if (in_taunt)
{
if (!HasCondition<TFCond_Taunting>(LOCAL_E))
{
hack::ExecuteCommand(format("slot", prev_slot + 1));
prev_slot = -1;
in_taunt = false;
}
else
taunt_t.update();
}
else
{
hack::ExecuteCommand("taunt");
in_taunt = true;
taunt_t.update();
}
}
},
"Autotaunt_CM");
});
} // namespace hacks::tf::autotaunt
@@ -10,39 +10,40 @@ static settings::Float min_size{ "dominatemark.min-size", "15.0f" };
static settings::Float max_size{ "dominatemark.max-size", "40.0f" };

static InitRoutine init([]() {
EC::Register(EC::Draw,
[]() {
if (!*draw_dominate)
return;
if (CE_BAD(LOCAL_E))
return;
re::CTFPlayerShared *shared_player = &re::C_BasePlayer::shared_(RAW_ENT(LOCAL_E));
for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{
CachedEntity *ent = ENTITY(i);
if (CE_GOOD(ent) && ent->m_bAlivePlayer() && re::CTFPlayerShared::IsDominatingPlayer(shared_player, i))
{
Vector draw_pos;
float size;
if (!ent->hitboxes.GetHitbox(0))
continue;
// Calculate draw pos
auto c = ent->InternalEntity()->GetCollideable();
draw_pos = ent->m_vecOrigin();
draw_pos.z += c->OBBMaxs().z;
// Calculate draw size
size = *max_size * 1.5f - ent->m_flDistance() / 20.0f;
size = fminf(*max_size, size);
size = fmaxf(*min_size, size);
EC::Register(
EC::Draw,
[]() {
if (!*draw_dominate)
return;
if (CE_BAD(LOCAL_E))
return;
re::CTFPlayerShared *shared_player = &re::C_BasePlayer::shared_(RAW_ENT(LOCAL_E));
for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{
CachedEntity *ent = ENTITY(i);
if (CE_GOOD(ent) && ent->m_bAlivePlayer() && re::CTFPlayerShared::IsDominatingPlayer(shared_player, i))
{
Vector draw_pos;
float size;
if (!ent->hitboxes.GetHitbox(0))
continue;
// Calculate draw pos
auto c = ent->InternalEntity()->GetCollideable();
draw_pos = ent->m_vecOrigin();
draw_pos.z += c->OBBMaxs().z;
// Calculate draw size
size = *max_size * 1.5f - ent->m_flDistance() / 20.0f;
size = fminf(*max_size, size);
size = fmaxf(*min_size, size);

Vector out;
if (draw::WorldToScreen(draw_pos, out))
{
static textures::sprite sprite = textures::atlas().create_sprite(447, 257, 64, 64);
sprite.draw(int(out.x - size / 2.0f), int(out.y - size), int(size), int(size), colors::white);
}
}
}
},
"dominatemark_draw");
Vector out;
if (draw::WorldToScreen(draw_pos, out))
{
static textures::sprite sprite = textures::atlas().create_sprite(447, 257, 64, 64);
sprite.draw(int(out.x - size / 2.0f), int(out.y - size), int(size), int(size), colors::white);
}
}
}
},
"dominatemark_draw");
});
@@ -130,7 +130,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
#define TICKS_TO_TIME(t) (TICK_INTERVAL * (t))
#define ROUND_TO_TICKS(t) (TICK_INTERVAL * TIME_TO_TICKS(t))
volatile uintptr_t **fp;
__asm__ volatile ("mov %%ebp, %0" : "=r"(fp));
__asm__ volatile("mov %%ebp, %0" : "=r"(fp));
bSendPackets = reinterpret_cast<bool *>(**fp - 8);

g_Settings.is_create_move = true;
@@ -9,4 +9,4 @@ namespace hooked_methods
DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawModelState_t &state, const ModelRenderInfo_t &info, matrix3x4_t *bone)
{
}
}
} // namespace hooked_methods
@@ -219,4 +219,7 @@ k_EItemType ItemModelMapper::GetItemType(CachedEntity *entity)
}

ItemManager g_ItemManager;
static InitRoutine init([]() { EC::Register(EC::LevelInit, []() { g_ItemManager = ItemManager{}; }, "clear_itemtypes"); });
static InitRoutine init([]() {
EC::Register(
EC::LevelInit, []() { g_ItemManager = ItemManager{}; }, "clear_itemtypes");
});
@@ -213,23 +213,24 @@ void sendIdentifyRequest()
logging::Info("[CO] Sending identify request for %u players", steamIds.size());
try
{
cathookOnlineService.userIdentify(steamIds, (std::function<void(co::ApiCallResult, std::optional<co::identified_user_group>)>) [steamIds](co::ApiCallResult result, std::optional<co::identified_user_group> group) {
if (result == co::ApiCallResult::OK)
{
processIdentifyResponse(steamIds, *group);
}
else
{
logging::Info("[CO] Something went wrong while identifying "
"%u players: code %d",
steamIds.size(), result);
for (auto i : steamIds)
cathookOnlineService.userIdentify(
steamIds, (std::function<void(co::ApiCallResult, std::optional<co::identified_user_group>)>) [steamIds](co::ApiCallResult result, std::optional<co::identified_user_group> group) {
if (result == co::ApiCallResult::OK)
{
identify_queue[i] = false;
processIdentifyResponse(steamIds, *group);
}
identify_stale = true;
}
});
else
{
logging::Info("[CO] Something went wrong while identifying "
"%u players: code %d",
steamIds.size(), result);
for (auto i : steamIds)
{
identify_queue[i] = false;
}
identify_stale = true;
}
});
}
catch (std::exception &ex)
{
@@ -242,7 +242,8 @@ CatCommand pl_set_state("pl_set_state", "cat_pl_set_state [playername] [state] (
continue;
std::string currname(info.name);
std::replace(currname.begin(), currname.end(), ' ', '-');
std::replace_if(currname.begin(), currname.end(), [](char x) { return !isprint(x); }, '*');
std::replace_if(
currname.begin(), currname.end(), [](char x) { return !isprint(x); }, '*');
if (currname.find(name) != 0)
continue;
id = i;
@@ -308,7 +309,8 @@ static int cat_pl_set_state_completionCallback(const char *c_partial, char comma
continue;
std::string name(info.name);
std::replace(name.begin(), name.end(), ' ', '-');
std::replace_if(name.begin(), name.end(), [](char x) { return !isprint(x); }, '*');
std::replace_if(
name.begin(), name.end(), [](char x) { return !isprint(x); }, '*');
names.push_back(name);
}
std::sort(names.begin(), names.end());
@@ -15,13 +15,13 @@ void EXPOSED_Epic_VACBypass_1337_DoNotSteal_xXx_$1_xXx_MLG()
{
((ICommandLine * (*) (void) ) dlsym(sharedobj::tier0().lmap, "CommandLine_Tier0"))()->RemoveParm("-textmode");
((ICommandLine * (*) (void) ) dlsym(sharedobj::tier0().lmap, "CommandLine_Tier0"))()->RemoveParm("-insecure");
uintptr_t Host_IsSecureServerAllowed_addr = gSignatures.GetEngineSignature("55 89 E5 83 EC ? E8 ? ? ? ? 8B 10 C7 44 24 ? ? ? ? ? 89 04 24 FF 52 ? 85 C0 74 ? C6 05");
uintptr_t Host_IsSecureServerAllowed_addr = gSignatures.GetEngineSignature("55 89 E5 83 EC ? E8 ? ? ? ? 8B 10 C7 44 24 ? ? ? ? ? 89 04 24 FF 52 ? 85 C0 74 ? C6 05");
uintptr_t Host_IsSecureServerAllowed2_addr = gSignatures.GetEngineSignature("55 89 E5 83 EC ? E8 ? ? ? ? 8B 10 C7 44 24 ? ? ? ? ? 89 04 24 FF 52 ? 85 C0 0F");
// +0x21 = allowSecureServers
// logging::Info("1337 VAC bypass: 0x%08x",
// Host_IsSecureServerAllowed_addr);
static BytePatch HostSecureServer(Host_IsSecureServerAllowed_addr, {0x55, 0x89, 0xE5, 0x83, 0xEC, 0x18, 0x31, 0xC0, 0x40, 0xC9, 0xC3});
static BytePatch HostSecureServer2(Host_IsSecureServerAllowed2_addr, {0x31, 0xC0, 0x40, 0xC3});
static BytePatch HostSecureServer(Host_IsSecureServerAllowed_addr, { 0x55, 0x89, 0xE5, 0x83, 0xEC, 0x18, 0x31, 0xC0, 0x40, 0xC9, 0xC3 });
static BytePatch HostSecureServer2(Host_IsSecureServerAllowed2_addr, { 0x31, 0xC0, 0x40, 0xC3 });
HostSecureServer.Patch();
HostSecureServer2.Patch();

@@ -22,24 +22,24 @@ static hooked_methods::types::SDL_PollEvent *SDL_PollEvent{ nullptr };

void applySdlHooks()
{
pointers::SDL_GL_SwapWindow = reinterpret_cast<hooked_methods::types::SDL_GL_SwapWindow *>(sharedobj::libsdl().Pointer(0xFD648));
pointers::SDL_GL_SwapWindow = reinterpret_cast<hooked_methods::types::SDL_GL_SwapWindow *>(sharedobj::libsdl().Pointer(0xFD648));
hooked_methods::original::SDL_GL_SwapWindow = *pointers::SDL_GL_SwapWindow;
*pointers::SDL_GL_SwapWindow = hooked_methods::methods::SDL_GL_SwapWindow;

pointers::SDL_PollEvent = reinterpret_cast<hooked_methods::types::SDL_PollEvent *>(sharedobj::libsdl().Pointer(0xFCF64));
pointers::SDL_PollEvent = reinterpret_cast<hooked_methods::types::SDL_PollEvent *>(sharedobj::libsdl().Pointer(0xFCF64));
hooked_methods::original::SDL_PollEvent = *pointers::SDL_PollEvent;
*pointers::SDL_PollEvent = hooked_methods::methods::SDL_PollEvent;
#if ENABLE_CLIP
pointers::SDL_SetClipboardText = reinterpret_cast<hooked_methods::types::SDL_SetClipboardText *>(sharedobj::libsdl().Pointer(0xFCF04));
pointers::SDL_SetClipboardText = reinterpret_cast<hooked_methods::types::SDL_SetClipboardText *>(sharedobj::libsdl().Pointer(0xFCF04));
hooked_methods::original::SDL_SetClipboardText = *pointers::SDL_SetClipboardText;
*pointers::SDL_SetClipboardText = hooked_methods::methods::SDL_SetClipboardText;
#endif
}

void cleanSdlHooks()
{
*pointers::SDL_GL_SwapWindow = hooked_methods::original::SDL_GL_SwapWindow;
*pointers::SDL_PollEvent = hooked_methods::original::SDL_PollEvent;
*pointers::SDL_GL_SwapWindow = hooked_methods::original::SDL_GL_SwapWindow;
*pointers::SDL_PollEvent = hooked_methods::original::SDL_PollEvent;
#if ENABLE_CLIP
*pointers::SDL_SetClipboardText = hooked_methods::original::SDL_SetClipboardText;
#endif

0 comments on commit 1c5d10a

Please sign in to comment.
You can’t perform that action at this time.