Skip to content

Instantly share code, notes, and snippets.

@nosoop
Last active April 13, 2018 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nosoop/bb5d3e228775719839b0bf02758b3828 to your computer and use it in GitHub Desktop.
Save nosoop/bb5d3e228775719839b0bf02758b3828 to your computer and use it in GitHub Desktop.
Prevents the console spam when medics are healing as of the 2018/04/12 TF2 update.
"Games"
{
"tf"
{
"Signatures"
{
"CWeaponMedigun::FindAndHealTargets"
{
"library" "server"
"linux" "@_ZN14CWeaponMedigun18FindAndHealTargetsEv"
"windows" "\x55\x8B\xEC\x83\xEC\x24\x53\x57\x8B\xF9\x2A\x2A\x2A\x2A\x2A\x2A\x83\xF8\xFF\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x8B\xD8"
}
}
"Addresses"
{
"CWeaponMedigun::FindAndHealTargets_MsgCall"
{
"signature" "CWeaponMedigun::FindAndHealTargets"
"linux"
{
"offset" "985" //0x3D9
}
"windows"
{
"offset" "1067" // 0x42B
}
}
}
}
}
/**
* Trying to learn how to patch assembly stuff, here's a fix for the debug printing.
*/
#pragma semicolon 1
#include <sourcemod>
#pragma newdecls required
public void OnPluginStart() {
ApplyPatch();
}
void ApplyPatch() {
Address pPatchLocation = Address_Null;
Handle gameconf = LoadGameConfigFile("tf.kill_debug_print");
if (!gameconf) {
LogError("Missing gamedata/tf.kill_debug_print");
return;
}
// on linux this is CWeaponMedigun::FindAndHealTargets(void)+3D9
pPatchLocation = GameConfGetAddress(gameconf, "CWeaponMedigun::FindAndHealTargets_MsgCall");
delete gameconf;
if (pPatchLocation == Address_Null) {
LogError("Failed to find address for CWeaponMedigun::FindAndHealTargets_MsgCall");
return;
}
// TODO figure out the best way to verify this
switch (LoadFromAddress(pPatchLocation, NumberType_Int8)) {
case 0xE8: {
// E8 ...
// https://reverseengineering.stackexchange.com/a/1996
NOPTheFuckOuttaHere(pPatchLocation, 5);
}
case 0xFF: {
// FF 15 ...
// https://reverseengineering.stackexchange.com/a/8763
NOPTheFuckOuttaHere(pPatchLocation, 6);
}
case 0x90: {
LogMessage("I think we patched it already.");
}
default: {
LogError("Not a call. I'm outta here.");
return;
}
}
}
void NOPTheFuckOuttaHere(Address pStart, int count) {
for (int i = 0; i < count; i++) {
StoreToAddress(pStart + i, 0x90, NumberType_Int8);
}
LogMessage("Good lord what have you done");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment