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

[ANY] Input Hooks - DevTools (1.9) [15-Jun-2022]


Post New Thread Reply   
 
Thread Tools Display Modes
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-27-2020 , 03:59   Re: [ANY] Input Hooks - DevTools (1.4) [10-May-2020]
Reply With Quote #11

Quote:
Originally Posted by Silvers View Post
Which game? Which plugin version? You modified that (and removed stuff?) why?

It has a specific check for reading "InValue" commands which would crash when reading with any other method, there maybe other commands which need to be read as objects instead, you can debug where its crashing by printing/logging the "command" variable value and seeing the last one printed before crash, and let me know what it is so I can fix the plugin.
CSGO, I put back that thing with "InValue" etc, but it seems the crash happens when I kill entities on SDKHook_Spawn with AcceptEntitiyInput(entitiy, "Kill");
I dhook AcceptInput on SDKHook_SpawnPost and no crashes.
__________________
Ilusion9 is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 02-28-2021 , 14:58   Re: [ANY] Input Hooks - DevTools (1.4a) [10-May-2020]
Reply With Quote #12

I have found a plugin conflict with [L4D2] Gas Cans by disawar1.

After many tests, I noticed that on c1m4_atrium map, when I enable the listen mode (sm_input_listen), right after pressing the elevator button the server crashes.

Here is the crash log.

I extracted the part from disawar1 code that triggers the crash and made a short plugin to test it.

To reproduce: Go to c1m4_atrium map, use !input_listen and then !testcrash.

Just reporting in case someone has the same problem.

Code snippet for testing below:

Spoiler


EDIT: Fixed by Silvers in newer versions.
__________________

Last edited by Marttt; 03-03-2021 at 07:46.
Marttt is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-03-2021 , 04:11   Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
Reply With Quote #13

Thanks, fixed. Example crash plugin was very helpful to test.
__________________
Silvers is offline
bottiger
AlliedModders Donor
Join Date: Dec 2010
Old 05-11-2021 , 18:56   Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
Reply With Quote #14

Quote:
Originally Posted by Silvers View Post
Thanks, fixed. Example crash plugin was very helpful to test.
Why not read fieldType to determine the type of the union?

https://github.com/ValveSoftware/sou...ariant_t.h#L37
__________________
bottiger is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-12-2021 , 03:52   Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
Reply With Quote #15

Quote:
Originally Posted by bottiger View Post
Why not read fieldType to determine the type of the union?

https://github.com/ValveSoftware/sou...ariant_t.h#L37
How?
__________________
Silvers is offline
bottiger
AlliedModders Donor
Join Date: Dec 2010
Old 05-13-2021 , 19:18   Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
Reply With Quote #16

Quote:
Originally Posted by Silvers View Post
How?
The offset of fieldType is the largest size of the union + sizeof(eVal).
__________________
bottiger is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-14-2021 , 22:19   Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
Reply With Quote #17

Quote:
Originally Posted by bottiger View Post
The offset of fieldType is the largest size of the union + sizeof(eVal).
How can it be done in this plugin? How do I determine if I should be reading an int or string etc? When calling DHookGetParamObjectPtrVar for an int the server will crash if it's supposed to be a string.
__________________
Silvers is offline
bottiger
AlliedModders Donor
Join Date: Dec 2010
Old 05-15-2021 , 15:00   Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
Reply With Quote #18

Quote:
Originally Posted by Silvers View Post
How can it be done in this plugin? How do I determine if I should be reading an int or string etc? When calling DHookGetParamObjectPtrVar for an int the server will crash if it's supposed to be a string.
Hi sorry I am not well versed in dhooks, I just tried using it last week.

But you could try this: I don't know if the offset should be divided by sizeof(int).

int fieldtype = DHookGetParamObjectPtrVar(hParams, 4, offset_of_fieldType, ObjectValueType_Int),

then check if fieldtype == FIELD_STRING or FIELD_INTEGER or some other type here:

https://github.com/ValveSoftware/sou.../datamap.h#L28
__________________
bottiger is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-15-2021 , 18:20   Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
Reply With Quote #19

I don't think that's the same offset as NetProps and DataMaps which would be possible to get the param type.
__________________
Silvers is offline
bottiger
AlliedModders Donor
Join Date: Dec 2010
Old 05-15-2021 , 23:28   Re: [ANY] Input Hooks - DevTools (1.5) [03-Mar-2021]
Reply With Quote #20

Quote:
Originally Posted by Silvers View Post
I don't think that's the same offset as NetProps and DataMaps which would be possible to get the param type.
Not sure what you mean by being the same offset as netprops or datamaps.

The acceptinput function you are hooking has a variant_t struct.

AcceptInput( const char *szInputName, CBaseEntity *pActivator, CBaseEntity *pCaller, variant_t Value, int outputID );

You have the definition of this struct right here:

PHP Code:
class variant_t
{
    
union
    
{
        
bool bVal;
        
string_t iszVal;
        
int iVal;
        
float flVal;
        
float vecVal[3];
        
color32 rgbaVal;
    };
    
CHandle<CBaseEntity> eVal; // this can't be in the union because it has a constructor.

    
fieldtype_t fieldType
All you have to do is access the fieldType member which has nothing to do with datamaps or netprops. It is just a tagged union.

Anyway I didn't want to spent any more time on this, but I was confused by what you meant and thought it couldn't be that hard so I decided to try it myself and it works.

PHP Code:
public MRESReturn AcceptInput(int pThisHandle hReturnHandle hParams)
{
    
// Get args
    
static char param[128];
    static 
char command[128];
    
DHookGetParamString(hParams1commandsizeof(command));

    
int paramType DHookGetParamObjectPtrVar(hParams416ObjectValueType_Int);
    
PrintToServer("param type %i"paramType); 
param type 0
2091 math_counter. (GetValue). "counter" (). 1 player caller 50
param type 1
2079 info_target. (InValue). "case" (). 1 player caller 50
__________________

Last edited by bottiger; 05-15-2021 at 23:42.
bottiger is offline
Reply


Thread Tools
Display Modes

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 18:02.


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