Mod_LoadCubemapSamples
0x00198c40 · 1298 bytes · unknown
_Z22Mod_LoadCubemapSamplesv
Decompiled
undefined (0 params)
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* Mod_LoadCubemapSamples() */
void Mod_LoadCubemapSamples(void)
{
int iVar1;
char cVar2;
uint uVar3;
char *pcVar4;
float *pfVar5;
int iVar6;
undefined *puVar7;
int *piVar8;
undefined4 uVar9;
undefined4 *puVar10;
int *piVar11;
int in_GS_OFFSET;
uint local_450;
char local_444 [260];
uint local_340 [3];
int local_334;
int *local_330;
int local_328;
char local_324 [260];
char local_220 [512];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
CMapLoadHelper::CMapLoadHelper((CMapLoadHelper *)local_340,0x2a);
pcVar4 = s_szMapPathName;
if ((&s_MapLumpFiles)[local_328 * 7] != 0) {
pcVar4 = local_324;
}
/* try { // try from 00198ca6 to 00198fdf has its CatchHandler @ 00199165 */
V_StripExtension(pcVar4,local_444,0x104);
if ((local_340[0] & 0xf) != 0) {
/* try { // try from 00199155 to 00199159 has its CatchHandler @ 00199165 */
Host_Error("Mod_LoadCubemapSamples: funny lump size in %s",s_szMapPathName);
}
uVar3 = local_340[0] >> 4;
pcVar4 = s_szMapPathName;
if ((&s_MapLumpFiles)[local_328 * 7] != 0) {
pcVar4 = local_324;
}
pcVar4 = (char *)va("%s [%s]",pcVar4,"cubemapsample");
pfVar5 = (float *)Hunk_AllocName(uVar3 * 0x14,pcVar4,true);
iVar6 = s_pMap;
*(float **)(s_pMap + 0xd4) = pfVar5;
*(uint *)(iVar6 + 0xd8) = uVar3;
iVar6 = (**(code **)(*g_pMaterialSystemHardwareConfig + 0x8c))(g_pMaterialSystemHardwareConfig);
puVar7 = &DAT_002b7e85;
if (iVar6 == 0) {
puVar7 = &DAT_002c79d4;
}
if (uVar3 != 0) {
local_450 = 0;
piVar11 = local_330;
do {
iVar6 = piVar11[1];
iVar1 = *piVar11;
pfVar5[2] = (float)piVar11[2];
pfVar5[1] = (float)iVar6;
*pfVar5 = (float)iVar1;
*(char *)(pfVar5 + 4) = (char)piVar11[3];
V_snprintf(local_220,0x200,"%s/c%d_%d_%d%s",local_444,*piVar11,piVar11[1],piVar11[2],puVar7);
piVar8 = (int *)(**(code **)(*materials + 0x134))(materials,local_220,"CubeMap textures",1,0);
pfVar5[3] = (float)piVar8;
if (piVar8 == (int *)0x0) {
LAB_00198e48:
iVar6 = (**(code **)(*g_pMaterialSystemHardwareConfig + 0x8c))
(g_pMaterialSystemHardwareConfig);
if (iVar6 == 0) {
piVar8 = (int *)pfVar5[3];
}
else {
Warning("Couldn\'t get HDR \'%s\' -- ",local_220);
V_snprintf(local_220,0x200,"%s/c%d_%d_%d",local_444,*piVar11,piVar11[1],piVar11[2]);
Warning("Trying non HDR \'%s\'\n",local_220);
piVar8 = (int *)(**(code **)(*materials + 0x134))
(materials,local_220,"CubeMap textures",1,0);
pfVar5[3] = (float)piVar8;
}
if (piVar8 != (int *)0x0) {
cVar2 = (**(code **)(*piVar8 + 0x3c))(piVar8);
if (cVar2 == '\0') goto LAB_00198d78;
}
V_snprintf(local_220,0x200,"%s/cubemapdefault",local_444);
piVar8 = (int *)(**(code **)(*materials + 0x134))
(materials,local_220,"CubeMap textures",1,0);
pfVar5[3] = (float)piVar8;
if (piVar8 == (int *)0x0) {
LAB_00198f90:
puVar10 = (undefined4 *)
(**(code **)(*materials + 0x134))
(materials,"engine/defaultcubemap","CubeMap textures",1,0);
pfVar5[3] = (float)puVar10;
}
else {
cVar2 = (**(code **)(*piVar8 + 0x3c))(piVar8);
if (cVar2 != '\0') goto LAB_00198f90;
puVar10 = (undefined4 *)pfVar5[3];
}
uVar9 = (**(code **)*puVar10)(puVar10);
Warning("Failed, using default cubemap \'%s\'\n",uVar9);
}
else {
cVar2 = (**(code **)(*piVar8 + 0x3c))(piVar8);
if (cVar2 != '\0') goto LAB_00198e48;
}
LAB_00198d78:
(**(code **)(*(int *)pfVar5[3] + 0x28))((int *)pfVar5[3]);
local_450 = local_450 + 1;
piVar11 = piVar11 + 4;
pfVar5 = pfVar5 + 5;
} while (uVar3 != local_450);
}
piVar11 = (int *)(**(code **)(*materials + 0x180))(materials);
if (piVar11 != (int *)0x0) {
/* try { // try from 00198feb to 00198fed has its CatchHandler @ 001991b2 */
(**(code **)(*piVar11 + 8))(piVar11);
}
if (uVar3 != 0) {
/* try { // try from 00199010 to 00199012 has its CatchHandler @ 001991ac */
(**(code **)(*piVar11 + 0x14))(piVar11,*(undefined4 *)(*(int *)(s_pMap + 0xd4) + 0xc));
goto LAB_00199013;
}
/* try { // try from 00199060 to 00199134 has its CatchHandler @ 0019918d */
piVar8 = (int *)CommandLine_Tier0();
iVar6 = (**(code **)(*piVar8 + 0xc))(piVar8,"-requirecubemaps",0);
if (iVar6 != 0) {
Sys_Error("Map \"%s\" does not have cubemaps!",s_szMapPathName);
}
V_snprintf(local_220,0x200,"%s/cubemapdefault",local_444);
piVar8 = (int *)(**(code **)(*materials + 0x134))(materials,local_220,"CubeMap textures",1,0);
if (piVar8 == (int *)0x0) {
LAB_001990fb:
piVar8 = (int *)(**(code **)(*materials + 0x134))
(materials,"engine/defaultcubemap","CubeMap textures",1,0);
}
else {
cVar2 = (**(code **)(*piVar8 + 0x3c))(piVar8);
if (cVar2 != '\0') goto LAB_001990fb;
}
(**(code **)(*piVar8 + 0x28))(piVar8);
/* try { // try from 0019913e to 00199140 has its CatchHandler @ 001991ac */
(**(code **)(*piVar11 + 0x14))(piVar11,piVar8);
LAB_00199013:
(**(code **)(*piVar11 + 0xc))(piVar11);
(**(code **)(*piVar11 + 4))(piVar11);
if (local_334 != 0) {
(**(code **)(*g_pFileSystem + 0x150))(g_pFileSystem,local_334);
}
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.