Mod_LoadGameLump
0x00199920 · 586 bytes · __cdecl
_Z16Mod_LoadGameLumpiPvi
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* Mod_LoadGameLump(int, void*, int) */
bool Mod_LoadGameLump(int param_1,void *param_2,int param_3)
{
bool bVar1;
byte bVar2;
int iVar3;
int iVar4;
int iVar5;
void *__ptr;
size_t __size;
int iVar6;
int in_GS_OFFSET;
char local_124 [260];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar4 = _DAT_003a8df0 + -1;
iVar5 = (_DAT_003a8df0 + -1) * 0x10;
iVar6 = _DAT_003a8df0;
do {
iVar3 = iVar4;
if (iVar3 < 0) {
bVar1 = false;
LAB_00199986:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return bVar1;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
iVar4 = g_GameLumpDict + iVar5;
if (*(int *)(g_GameLumpDict + iVar5) == param_1) {
bVar1 = false;
__size = *(size_t *)(iVar4 + 0xc);
if ((int)__size <= param_3) {
bVar2 = *(byte *)(iVar4 + 4) & 1;
if ((*(byte *)(iVar4 + 4) & 1) != 0) {
__size = *(int *)(g_GameLumpDict + 8 + iVar6 * 0x10) - *(int *)(iVar4 + 8);
}
if (s_MapBuffer == 0) {
V_strncpy(local_124,g_GameLumpFilename,0x104);
iVar4 = (**(code **)(*g_pFileSystem + 0x114))(g_pFileSystem,local_124,&DAT_002a3e98,0,0,0)
;
bVar1 = false;
if (iVar4 != 0) {
(**(code **)(g_pFileSystem[1] + 0x10))
(g_pFileSystem + 1,iVar4,*(undefined4 *)(g_GameLumpDict + 8 + iVar5),0);
if (bVar2 == 0) {
iVar5 = (**(code **)g_pFileSystem[1])(g_pFileSystem + 1,param_2,__size,iVar4);
bVar1 = 0 < iVar5;
(**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,iVar4);
}
else {
__ptr = malloc(__size);
iVar5 = (**(code **)g_pFileSystem[1])(g_pFileSystem + 1,__ptr,__size,iVar4);
(**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,iVar4);
if (iVar5 < 1) {
free(__ptr);
}
}
}
}
else {
bVar1 = false;
if (((int)(*(int *)(iVar4 + 8) + __size) <= DAT_003a849c) && (bVar2 == 0)) {
_V_memcpy(param_2,(void *)(s_MapBuffer + *(int *)(iVar4 + 8)),__size);
bVar1 = true;
}
}
}
goto LAB_00199986;
}
iVar4 = iVar3 + -1;
iVar5 = iVar5 + -0x10;
iVar6 = iVar3;
} while( true );
}
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.