Question R_RegisterShader and ent->customShader

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

xyzzy

Full Member
Nobleman
Oct 20, 2019
73
2,353
2
How long you been coding/hacking?
<2 months
Coding Language
C++
I have a refentity_t->renderfx based wallhack working, but wish to assign a specific shader (in this case blue - "powerups/quad") to playermodels.

C++:
// in my solution, copied from King-Orgy, updated the offset

static qhandle_t (*R_RegisterShader)(const char* name) = (int(__cdecl*)(const char*))0x541A00;

// RE_RegisterShader from SDK

qhandle_t RE_RegisterShader( const char *name ) {
    shader_t    *sh;

    if ( strlen( name ) >= MAX_QPATH ) {
        Com_Printf( "Shader name exceeds MAX_QPATH\n" );
        return 0;
    }

    sh = R_FindShader( name, LIGHTMAP_2D, qtrue );

    // we want to return 0 if the shader failed to
    // load for some reason, but R_FindShader should
    // still keep a name allocated for it, so if
    // something calls RE_RegisterShader again with
    // the same name, we don't try looking for it again
    if ( sh->defaultShader ) {
        return 0;
    }

    return sh->index;
}

//

void WINAPI hooked_AddRefEntityToScene(refEntity_t* ent)
{
    if (ent->frame) // playermodels only, not items
    {
        ent->renderfx |= RF_DEPTHHACK;
        ent->customShader |= R_RegisterShader("powerups/quad");
    }
    oAddRefEntityToScene(ent);
}
The RegisterShader wrapper appears to be failing.

I could try an inline asm function, but I would prefer to have a typedef like King-Orgy does in his. I am trying to improve my c++ skills as well, so don't want to be reliant on asm. The following IDA extract is the exact same thing i'm trying to replicate (King-Orgy's earlier version internal hack, hence the different offset for RegisterShader).

1580547777769.png
 

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,277
37,938
268
i'm gonna go on a limb here and say no one has hacked this in a very long time. And idk who that king-orgy guy is, sick name though

How does it fail?
What error do you get?
What was your debugging process?
 
  • Like
Reactions: xyzzy

xyzzy

Full Member
Nobleman
Oct 20, 2019
73
2,353
2
Upon reflection I made quite a few rookie errors here.

RE_RegisterShader and RE_FindShader are called during every map load. For some reason, I was thinking they were only called during process load.

What I was doing was calling it only once when the hook was installed. If I injected in menu screen then loaded a map, my customerShader wouldn't work. Once a new map is loaded my customShader was overwritten. To that end, the effect of my customShader would only work if I injected after map load and only for that map.

Anywho, solution was to call my RegisterShader on every map load - resolved.
 

iMoD1998

PPC Haxor
Trump Tier Donator
Dank Tier Donator
Full Member
Nobleman
Jul 10, 2020
66
3,668
3
i'm gonna go on a limb here and say no one has hacked this in a very long time. And idk who that king-orgy guy is, sick name though

How does it fail?
What error do you get?
What was your debugging process?
King-Orgy is one of the most OG COD hackers tbh.

 

xyzzy

Full Member
Nobleman
Oct 20, 2019
73
2,353
2
I've actually been going through a lot of his (King-Orgy) COD and various quake sources to learn from them - see how he did things, etc. IMO, his sources are a wealth of knowledge re: the Idtech 3-4 engine.
 
  • Like
Reactions: iMoD1998

Rake

Cesspool Admin
Administrator
Jan 21, 2014
11,573
78,998
2,316
King Orgy did a bunch of Unreal Tournament shit too, he's been around for like 15 years
 
  • Love
Reactions: iMoD1998
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Thread starter Similar threads Forum Replies Date
Sola Solved Issue with grabbing z, y and z of ent in loop. Questions & Answers - Hacking Help 3
Community Mods League of Legends Accounts