BigPackets Forum

BigPacket Supported Games => Garrys Mod => Topic started by: asdqwe1548 on August 19, 2018, 04:08:28 am

Title: RunCommand won't hook
Post by: asdqwe1548 on August 19, 2018, 04:08:28 am
I really didn't want to make this thread but I cannot figure out why RunCommand will not hook, the hook doesn't crash it just isn't called.

constexpr int run_cmd = 18;
static void __stdcall run_command(c_base_entity* player, CUserCmd* ucmd, IMoveHelper* moveHelper);
typedef void(__stdcall* run_cmd_t)   (CPrediction*, c_base_entity*, CUserCmd*, IMoveHelper*);
void hooks::run_command(c_base_entity* player, CUserCmd* ucmd, IMoveHelper* moveHelper)
    static auto original = g_hooks.prediction_hook->original<run_cmd_t> (idx::run_cmd);
   std::cout << "runcmd" << std::endl;
   original(g_prediction, player, ucmd, moveHelper);
How I am getting CPrediction:
g_prediction = get_interface<CPrediction>("client.dll", "VClientPrediction001");
I also tried using __fastcall and setting ecx and edx registers as arguments.
I am 99% sure the index is right as I checked on the dylib and dll.