Host_InitProcessor
0x00178fc0 · 814 bytes · unknown
_Z18Host_InitProcessorv
Decompiled
undefined (0 params)
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* Host_InitProcessor() */
void Host_InitProcessor(void)
{
char *pcVar1;
byte bVar2;
char cVar3;
int iVar4;
int iVar5;
uint uVar6;
undefined4 *puVar7;
int in_GS_OFFSET;
byte bVar8;
undefined *local_238;
double local_234;
char acStack_221 [257];
char local_120 [4];
undefined4 local_11c [63];
int local_20;
bVar8 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar4 = GetCPUInformation();
local_234 = (double)*(longlong *)(iVar4 + 8) * 1e-06;
if (local_234 <= 1000.0) {
local_238 = &DAT_002b2839;
}
else {
local_238 = &DAT_002b283d;
local_234 = local_234 * 0.001;
}
pcVar1 = acStack_221 + 1;
V_strncpy(pcVar1,*(char **)(iVar4 + 0x10),0x100);
V_strncat(pcVar1," ",0x100,-1);
bVar2 = *(byte *)(iVar4 + 4);
if ((bVar2 & 8) != 0) {
cVar3 = MathLib_SSEEnabled();
if (cVar3 == '\0') {
V_strncat(pcVar1,"(SSE) ",0x100,-1);
bVar2 = *(byte *)(iVar4 + 4);
}
else {
V_strncat(pcVar1,"SSE ",0x100,-1);
bVar2 = *(byte *)(iVar4 + 4);
}
}
if ((bVar2 & 0x10) != 0) {
cVar3 = MathLib_SSE2Enabled();
if (cVar3 == '\0') {
V_strncat(pcVar1,"(SSE2) ",0x100,-1);
bVar2 = *(byte *)(iVar4 + 4);
}
else {
V_strncat(pcVar1,"SSE2 ",0x100,-1);
bVar2 = *(byte *)(iVar4 + 4);
}
}
if ((bVar2 & 0x40) != 0) {
cVar3 = MathLib_MMXEnabled();
if (cVar3 == '\0') {
V_strncat(pcVar1,"(MMX) ",0x100,-1);
bVar2 = *(byte *)(iVar4 + 4);
}
else {
V_strncat(pcVar1,"MMX ",0x100,-1);
bVar2 = *(byte *)(iVar4 + 4);
}
}
if ((bVar2 & 1) != 0) {
V_strncat(pcVar1,"RDTSC ",0x100,-1);
bVar2 = *(byte *)(iVar4 + 4);
}
if ((bVar2 & 2) != 0) {
V_strncat(pcVar1,"CMOV ",0x100,-1);
bVar2 = *(byte *)(iVar4 + 4);
}
if ((bVar2 & 4) != 0) {
V_strncat(pcVar1,"FCMOV ",0x100,-1);
}
iVar5 = _V_strlen(pcVar1);
acStack_221[iVar5] = '\0';
if (*(char *)(iVar4 + 5) == '\x01') {
ConDMsg("1 CPU, Frequency: %.01f %s, Features: %s\n",local_234,local_238,pcVar1);
}
else {
puVar7 = local_11c;
for (iVar5 = 0x3f; iVar5 != 0; iVar5 = iVar5 + -1) {
*puVar7 = 0;
puVar7 = puVar7 + (uint)bVar8 * -2 + 1;
}
local_120[0] = '\0';
local_120[1] = '\0';
local_120[2] = '\0';
local_120[3] = '\0';
uVar6 = (uint)*(byte *)(iVar4 + 6);
if (*(byte *)(iVar4 + 6) != *(byte *)(iVar4 + 5)) {
V_snprintf(local_120,0x100," (%i physical)",uVar6);
uVar6 = (uint)*(byte *)(iVar4 + 5);
}
ConDMsg("%i CPUs%s, Frequency: %.01f %s, Features: %s\n",uVar6,local_120,local_234,local_238,
pcVar1);
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.