RandMem
0x00091a60 · 232 bytes · __cdecl
_Z7RandMemPvi
Decompiled
undefined (2 params)
/* RandMem(void*, int) */
void RandMem(void *param_1,int param_2)
{
uint *puVar1;
uint uVar2;
uint *puVar3;
if (3 < param_2) {
uVar2 = param_2 - 4U >> 2;
puVar1 = (uint *)((int)param_1 + uVar2 * 4 + 4);
do {
puVar3 = (uint *)((int)param_1 + 4);
g_iunRandMask = g_iunRandMask + 1;
g_unRandCur = g_unRandCur + 0x25fe6761;
*(uint *)param_1 = g_unRandCur ^ *(uint *)(k_rgunMask + (g_iunRandMask % 0x11) * 4);
param_1 = puVar3;
} while (puVar3 != puVar1);
param_2 = (param_2 - 4U) + uVar2 * -4;
param_1 = puVar1;
}
puVar1 = (uint *)((int)param_1 + param_2);
if (0 < param_2) {
do {
puVar3 = (uint *)((int)param_1 + 1);
g_iunRandMask = g_iunRandMask + 1;
g_unRandCur = g_unRandCur + 0x25fe6761;
*(byte *)param_1 =
(byte)*(undefined4 *)(k_rgunMask + (g_iunRandMask % 0x11) * 4) ^ (byte)g_unRandCur;
param_1 = puVar3;
} while (puVar3 != puVar1);
}
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.