Raised This Month: $51 Target: $400
 12% 

[H3LP] g_pGameRules


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 01-03-2020 , 11:21   [H3LP] g_pGameRules
Reply With Quote #1

Hello. I'm trying to retrieve g_pGameRules using gamerules but it always returns 0. Game is TFC. Any ideas ? The signature is correct, the file InstallGameRules_tfc is well parsed.
Note: I'm using Debian.

PHP Code:
#include <amxmodx>
#include <orpheu>
#include <orpheu_stocks>

new OrpheuHookg_hGameRules,
new 
g_pGameRules;

public 
plugin_precache()
{
    
g_hGameRules OrpheuRegisterHook(OrpheuGetFunction("InstallGameRules_tfc"), "OnInstallGameRules"OrpheuHookPost);
}

public 
OnInstallGameRules()
{
    
g_pGameRules OrpheuGetReturn();

    
server_print("g_pGameRules -> %d"g_pGameRules); // always prints 0

    
OrpheuUnregisterHook(g_hGameRules);


Last edited by DarthMan; 01-03-2020 at 11:23.
DarthMan is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 01-03-2020 , 17:18   Re: [H3LP] g_pGameRules
Reply With Quote #2

Apparently, it seems that the function only gets called on Windows. Any fix?
DarthMan is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 01-03-2020 , 21:07   Re: [H3LP] g_pGameRules
Reply With Quote #3

Quote:
Originally Posted by DarthMan View Post
Apparently, it seems that the function only gets called on Windows. Any fix?
Have you tried to get the signature?
__________________
Spirit_12 is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 01-04-2020 , 05:17   Re: [H3LP] g_pGameRules
Reply With Quote #4

Quote:
Originally Posted by Spirit_12 View Post
Have you tried to get the signature?
Yes, I have it. But I looked with IDA and it seems that g_oGameRules is retrieved from CWorld:recache directly on Linux, whereas on Windows it's retrieved from InstallGameRules. That means that the InstallGameRules function never gets called on Linux.

Edit: For linux I'm using a symbol. Guess what I can do is to get memory address of that function and add a displacement to point to the g_pGameRules pointer value. I'm not home today, but I'll try tomorrow in the evening/night and see how it works. On Windows btw I have seen that g_pGameRules in the same runction returns InstallGameRules value, whereas, as I said, on Linux it foes not. But I am pretty sure that before Eteampipe with old tfc it did, the function is still there, but guess Valve changed some code for Linux and probably forgot to remove that function.
Actually, the print didn't even work, as the function is never calIed, so printed the value in plugin_init.

Last edited by DarthMan; 01-04-2020 at 06:25.
DarthMan is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode