chettoy / apexsky

https://apex.chettoy.com
GNU General Public License v3.0
134 stars 73 forks source link

How to add this to your cheat or Can you add this please? #154

Open pplegends opened 1 week ago

pplegends commented 1 week ago

Custom aim assist strength

1. Locate apex's clientstate interface and go to it's VMT at clientstate_base+0x10: Code:

*(_QWORD *)(a1 + 0x10) = vft::ClientState; // <-----

vft__ClientState dq offset sub_14030A8B4
.rdata:00000001413B5968 00 00                                                     ; DATA XREF: sub_1402FFDF0+106↑o
.rdata:00000001413B5968                                                           ; sub_140300360+27↑o
.rdata:00000001413B5970 F0 02 2A 40 01 00+                dq offset sub_1402A02F0 ; #STR: "[$&*,`] c 165654309", "{}()':"
.rdata:00000001413B5978 F0 03 2A 40 01 00+                dq offset sub_1402A03F0
.rdata:00000001413B5980 70 F8 29 40 01 00+                dq offset sub_14029F870
.rdata:00000001413B5988 80 F9 29 40 01 00+                dq offset sub_14029F980
.rdata:00000001413B5990 60 0B 2A 40 01 00+                dq offset sub_1402A0B60
.rdata:00000001413B5998 40 0B 2A 40 01 00+                dq offset sub_1402A0B40
.rdata:00000001413B59A0 F0 0A 1E 40 01 00+                dq offset sub_1401E0AF0
.rdata:00000001413B59A8 A0 0B 2A 40 01 00+                dq offset sub_1402A0BA0
.rdata:00000001413B59B0 F0 0A 1E 40 01 00+                dq offset sub_1401E0AF0
.rdata:00000001413B59B8 10 04 2A 40 01 00+                dq offset CClientStatePlus10__OnReceiveServerInfo
.rdata:00000001413B59C0 10 10 2A 40 01 00+                dq offset sub_1402A1010 ; #STR: "ProcessSendTable: RecvTable_RecvClassInfos failed.\n"
.rdata:00000001413B59C8 80 10 2A 40 01 00+                dq offset sub_1402A1080 ; #STR: "ProcessClassInfo: LinkClasses failed\n", "ProcessClassInfo: invalid class index (%d).\n", "CL_ParseClassInfo_EndClasses: CreateDecoders failed.\n"
.rdata:00000001413B59D0 90 15 2A 40 01 00+                dq offset CClientStatePlus10__ProcessPlaylistOverride ; #STR: "SVC_Playlists" // <------ target

2. Place a hook on ProcessPlaylistOverride at index 13. Hook handler: Code:

void hk_process_playlist_override(void* inst, void* net_msg)
{
    char* data = reinterpret_cast<char*>(BASE_OF(net_msg) + 0x21);
    respawn::hijack_playlist_data(data);
        // invoke original...
}

bool hijack_playlist_data(void *data)
    {
        if (g.conf.override_controller_aa)
        {
            auto pdata = data;
            auto pstr_assist_adspull_disable = find_substr((char *)pdata, "aimassist_adspull_disabled");
            if (pstr_assist_adspull_disable)
            {
                auto toggle = find_substr(pstr_assist_adspull_disable, "1");
                if (!toggle)
                {
                    toggle = find_substr(pstr_assist_adspull_disable, "0");
                }

                if (toggle)
                {
                    if (toggle[0] == '1')
                    {
                        toggle[0] = '0';
                    }
                }
            }

            auto pstr_assist_magnet_pc = find_substr((char *)pdata, "aimassist_magnet_pc");
            if (pstr_assist_magnet_pc)
            {
                auto value = find_substr(pstr_assist_magnet_pc, "0.");
                if (value)
                { // switch case this, switch case that. its just 2 branches bro
                    if (g.conf.override_controller_aa_value == 100)
                    {
                        value[0] = '1';
                        value[1] = '.';
                        value[2] = '0';
                    } else if(g.conf.override_controller_aa_value > 0)
                    {
                        value[0] = '0';
                        value[1] = '.';
                        int adjusted = g.conf.override_controller_aa_value / 10;
                        value[2] = tools::integer2char(adjusted);
                    }
                }
            }
        }

        return true;
    }
pplegends commented 1 week ago

This is an example of this implementation, but it’s on R5Reloaded. https://github.com/cryotb/R5R_AimAssist_Forcer

chettoy commented 3 days ago

The two implementations you mentioned are not the same. Regarding the first implementation, hooking a function in the game greatly increases the risk of being detected.