Skip to content

Commit e73902d

Browse files
committed
Fix HammerID patch
1 parent a5ba5f6 commit e73902d

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

gamedata/cs2fixes.jsonc

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,13 @@
373373
"library": "server",
374374
"windows": "48 89 5C 24 ? 57 48 83 EC ? 48 8B 02 48 8B F9 48 8B CA 48 8B DA FF 90 ? ? ? ? 84 C0 74 ? F3 0F 10 8F",
375375
"linux": "48 8B 06 55 48 89 E5 41 54 49 89 FC 48 89 F7 53 48 89 F3 FF 90"
376+
},
377+
// Function that only has "hammerUniqueId" string, signature points to the outer if statement that determines if hammerid gets written to schema
378+
"SetSchemaHammerUniqueId":
379+
{
380+
"library": "server",
381+
"windows": "75 ? 48 8B 03 48 8B CB FF 90 ? ? ? ? 84 C0 74 ? 48 8D 05",
382+
"linux": "75 ? 48 8B 03 48 8D 15 ? ? ? ? 48 8B 80 ? ? ? ? 48 39 D0 75 ? 48 83 C4"
376383
}
377384
},
378385
"Offsets":
@@ -393,11 +400,6 @@
393400
"windows": 103,
394401
"linux": 102
395402
},
396-
"GetHammerUniqueId":
397-
{
398-
"windows": 112,
399-
"linux": 111
400-
},
401403
"CBaseEntity::Use":
402404
{
403405
"windows": 145,
@@ -548,6 +550,12 @@
548550
{
549551
"windows": "49 89 F8 90",
550552
"linux": "48 89 DA 90 90"
553+
},
554+
// jnz -> jmp
555+
"SetSchemaHammerUniqueId":
556+
{
557+
"windows": "EB",
558+
"linux": "EB"
551559
}
552560
}
553561
}

src/entitylistener.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@ CEntityListener* g_pEntityListener = nullptr;
3131

3232
CConVar<bool> g_cvarGrenadeNoBlock("cs2f_noblock_grenades", FCVAR_NONE, "Whether to use noblock on grenade projectiles", false);
3333

34-
void Patch_GetHammerUniqueId(CEntityInstance* pEntity)
35-
{
36-
static int offset = g_GameConfig->GetOffset("GetHammerUniqueId");
37-
void** vtable = *(void***)pEntity;
38-
39-
// xor al, al -> mov al, 1
40-
// so it always returns true and allows hammerid to be copied into the schema prop
41-
Plat_WriteMemory(vtable[offset], (uint8_t*)"\xB0\x01", 2);
42-
}
43-
4434
void CEntityListener::OnEntitySpawned(CEntityInstance* pEntity)
4535
{
4636
#ifdef _DEBUG
@@ -59,8 +49,6 @@ void CEntityListener::OnEntitySpawned(CEntityInstance* pEntity)
5949

6050
void CEntityListener::OnEntityCreated(CEntityInstance* pEntity)
6151
{
62-
ExecuteOnce(Patch_GetHammerUniqueId(pEntity));
63-
6452
if (!V_strcmp("cs_gamerules", pEntity->GetClassname()))
6553
g_pGameRules = ((CCSGameRulesProxy*)pEntity)->m_pGameRules;
6654
}

src/patches.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ CMemPatch g_CommonPatches[] =
3434
CMemPatch("BotNavIgnore", "BotNavIgnore"),
3535
CMemPatch("CheckJumpButtonWater", "FixWaterFloorJump"),
3636
CMemPatch("CPhysBox_Use", "CPhysBox_Use"),
37+
CMemPatch("SetSchemaHammerUniqueId", "SetSchemaHammerUniqueId"),
3738
};
3839

3940
CConVar<bool> cs2f_movement_unlocker_enable("cs2f_movement_unlocker_enable", FCVAR_NONE, "Whether to enable movement unlocker", false,

0 commit comments

Comments
 (0)