From d9f39f14fa0b0e8d025a8deef1d0c85da89c31f6 Mon Sep 17 00:00:00 2001 From: Emma Miler <27428383+emma-miler@users.noreply.github.com> Date: Wed, 15 Jun 2022 01:10:39 +0200 Subject: Fix bug where emit wouldn't be blocked if uppercase (#192) * Fix bug where emit wouldnt be blocked if uppercase * Moved emit blocker to ExploitFixes.cpp * Format change * Use `strnicmp` instead of a custom functions * Resolve merge conflicts * Format changes --- NorthstarDedicatedTest/emit_blocker.cpp | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 NorthstarDedicatedTest/emit_blocker.cpp (limited to 'NorthstarDedicatedTest/emit_blocker.cpp') diff --git a/NorthstarDedicatedTest/emit_blocker.cpp b/NorthstarDedicatedTest/emit_blocker.cpp deleted file mode 100644 index 3f996c69..00000000 --- a/NorthstarDedicatedTest/emit_blocker.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "pch.h" -#include "cvar.h" - -ConVar* sv_cheats; - -typedef char(__fastcall* function_containing_emit_t)(uint64_t a1, uint64_t a2); -function_containing_emit_t function_containing_emit; - -char function_containing_emit_hook(uint64_t unknown_value, uint64_t command_ptr) -{ - char* command_string = *(char**)(command_ptr + 1040); // From decompile - if (!sv_cheats->m_Value.m_nValue && !strncmp(command_string, "emit", 5)) - { - spdlog::info("Blocking command \"emit\" because sv_cheats was 0"); - return 1; - } - return function_containing_emit(unknown_value, command_ptr); -} - -void InitialiseServerEmit_Blocker(HMODULE baseAddress) -{ - HookEnabler hook; - sv_cheats = g_pCVar->FindVar("sv_cheats"); - ENABLER_CREATEHOOK( - hook, (char*)baseAddress + 0x5889A0, &function_containing_emit_hook, reinterpret_cast(&function_containing_emit)); -} \ No newline at end of file -- cgit v1.2.3