profile
viewpoint

asherkin/spider 41

SourcePawn Web Compiler

asherkin/accelerator 34

Community Crash Reporting for SRCDS

asherkin/SteamTools 12

SteamWorks for SourceMod

asherkin/sm-ext-rs 11

Library for writing SourceMod Extensions in Rust

asherkin/gamedata-to-symbols 2

Generate Breakpad symbol files from SourceMod gamedata

asherkin/smx-pki 2

Test scripts for signing SourceMod plugins

asherkin/discograph 1

A Discord Bot that infers relationships between users and draws pretty graphs

pull request commentalliedmodders/sourcemod

Fix crash when calling TF2_IsHolidayActive while no map is running

Is there a more concrete thing we can check here that is actually related to the crash? E.g. is it actually that the gamerules ptr is invalid between maps and sdktools should be clearing it out?

Mikusch

comment created time in 4 days

issue commentalliedmodders/sourcemod

StartMessage/EndMessage (get state g_IsMsgInExec)

Holding a global resource (like having a started usermessage) over a context switch is a plugin bug, UMs should be started, written to, and sent all within a single execution cycle.

wS-SM

comment created time in 5 days

issue closedalliedmodders/sourcemod

StartMessage/EndMessage (get state g_IsMsgInExec)

For example, if several plugins have done "say_team" hook and are doing this:

StartMessage.. return Plugin_Handled;

An error occurs:

// https://github.com/alliedmodders/sourcemod/blob/1fbe5e1daaee9ba44164078fe7f59d862786e612/core/smn_usermsgs.cpp#L421
if (g_IsMsgInExec)
{
    return pCtx->ThrowNativeError("Unable to execute a new message, there is already one in progress");
}

Do just return INVALID_HANDLE or let plugins know the value of variable "g_IsMsgInExec".

closed time in 5 days

wS-SM

issue commentalliedmodders/sourcemod

StartMessage/EndMessage (get state g_IsMsgInExec)

This error indicates a plugin bug, it appears to be correct.

wS-SM

comment created time in 5 days

pull request commentalliedmodders/sourcemod

SourceMod SDK: introduction into Valve memory system

I do think this might end up a little painful across games, there was a bunch of Source games that had memoveride disabled on Linux builds, so a lot of testing will be required (and CI isn't going to validate anything here).

If your root issue is just cross-crt allocation around CUtlVector, you might be interested in a solution similar to #1165.

Other than seeming like a large-ish linkage change here (which we've done worse of recently, and paid the support price), I'm not really for or against it, but would like the thoughts of @psychonic who knows the engine much better than I.

Wend4r

comment created time in 12 days

issue closedalliedmodders/sourcepawn

Unable to compile. Compiler thinks endlessly. (#define X X)

#define P P

public void OnPluginStart() {
	P("msg");
}

C++: C3861 'P': identifier not found

SM compiler 1.10/1.11: The compiler thinks endlessly and nothing happens.

closed time in 12 days

wS-SM

issue commentalliedmodders/sourcepawn

Unable to compile. Compiler thinks endlessly. (#define X X)

This is a duplicate of #526 and was fixed in SourcePawn master a while back.

wS-SM

comment created time in 12 days

pull request commentalliedmodders/sourcemod

SourceMod SDK: introduction into Valve memory system

Thank you for the PR, but this is going to need a lot more description and rationale to consider merging.

Wend4r

comment created time in 15 days

issue commentalliedmodders/sourcemod

DHooks might crash on plugin reload

Last time this was discussed you had a 2nd plugin using DHooks loaded with a likely faulty hook setup, and the crash report indicates that plugin was loaded at the time of that crash. Can I just confirm you've reproduce this with only a single, known-good, DHooks-using plugin running?

Adrianilloo

comment created time in 15 days

issue closedalliedmodders/sourcepawn

while(true) loop failes to compile

When writing some stocks to replace some sourcepawn natives (testing reasons) I had a while true loop which now failes to compile with the latest canges on master.

[0.0390] SourcePawn Compiler 1.11
[0.0390] Copyright (c) 1997-2006 ITB CompuPhase
[0.0390] Copyright (c) 2004-2021 AlliedModders LLC
[0.0390]
[0.0390] E:\programming\spshell-includes\include\string.inc(22) : error 206: redundant test: constant expression is non-zero
[0.0390]
[0.0390] 1 Error.

This is the code in string.inc and line 22 is while(true).

stock int strlen(const char[] str)
{
    int i = 0;
    while(true)
    {
        if (str[i] == '\x0')
        {
            return i;
        }

        ++i;
    }
}

Whereas using a for loop with ;; works for this case.

stock int strlen(const char[] str)
{
    int i = 0;
    for(;;)
    {
        if (str[i] == '\x0')
        {
            return i;
        }

        ++i;
    }
}

closed time in 19 days

c0rp3n

issue commentalliedmodders/sourcepawn

while(true) loop failes to compile

while(true) has always been a warning in SourcePawn.

stock int my_strlen(const char[] str)
{
    int i = 0;
    while(true)
    {
        if (str[i] == '\x0')
        {
            return i;
        }

        ++i;
    }
}

public void OnPluginStart()
{
    my_strlen("");
}
SourcePawn Compiler 1.10.0.6453
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2018 AlliedModders LLC

/groups/sourcemod/upload_tmp/text7V4gn8.sp(4) : warning 206: redundant test: constant expression is non-zero
/groups/sourcemod/upload_tmp/text7V4gn8.sp(13) : warning 209: function "my_strlen" should return a value

Note that the stock has to be used for the errors to show up pre-1.11, as previously error reporting was silenced for unused stocks (this is mentioned in the 1.11 migration doc).

c0rp3n

comment created time in 19 days

issue commentalliedmodders/sourcemod

FreeEvent call in EventManager::OnFireEvent breaks event pointer

https://bugs.alliedmods.net/show_bug.cgi?id=5097 has the history here and a lot of discussion around the various options, unfortunately leaking memory is not a great option.

Alexeyt89

comment created time in 19 days

push eventalliedmodders/sourcemod

Mikusch

commit sha afc93107049bfd92132ed053293ab606d8f284c9

Add LookupEntityAttachment & GetEntityAttachment natives (#1653) Using the virtual `CBaseAnimating::GetAttachment(int, matrix3x4_t &)` was a deliberate choice because virtual offsets are generally easier to maintain than signatures. The `matrix3x4_t` is converted to world position and world angles internally. Some of the other overloads are also inlined on a few games, making this the best choice. Since this call can only be used on classes inheriting `CBaseAnimating`, we check if the `DT_BaseAnimating` SendTable exists on the entity, throwing a native error if it doesn't. This safeguard could be greatly improved with a call to `CBaseEntity::GetBaseAnimating`, but would require more gamedata (maybe something to consider for the future?)

view details

push time in 19 days

PR merged alliedmodders/sourcemod

Reviewers
Add LookupEntityAttachment & GetEntityAttachment natives

#1555

This is a very common SDKCall used in plugins and I think it'd be a great idea to have a native for it.

I agree.

Overview

This PR adds two new natives:

// Same as SDKCall to:  int CBaseAnimating::LookupAttachment(const char *)
native int LookupEntityAttachment(int entity, const char[] name);

// Same as SDKCall to:  bool CBaseAnimating::GetAttachment(int, Vector &, QAngle &)
native bool GetEntityAttachment(int entity, int attachment, float origin[3], float angles[3]);

Example usage:

int attachment = LookupEntityAttachment(client, "head");
if (attachment == 0)
	return;

float origin[3], angles[3];
if (!GetEntityAttachment(client, attachment, origin, angles))
	return;

PrintToServer("Attachment %d at: (%f %f %f)", attachment, origin[0], origin[1], origin[2]);

Gamedata for CS:GO, CS:S, L4D, L4D2 and TF2 is provided, but has not been tested by me.

Implementation

Using the virtual CBaseAnimating::GetAttachment(int, matrix3x4_t &) was a deliberate choice because virtual offsets are generally easier to maintain than signatures. The matrix3x4_t is converted to world position and world angles internally. Some of the other overloads are also inlined on a few games, making this the best choice.

Since this call can only be used on classes inheriting CBaseAnimating, we check if the DT_BaseAnimating SendTable exists on the entity, throwing a native error if it doesn't. This safeguard could be greatly improved with a call to CBaseEntity::GetBaseAnimating, but would require more gamedata (maybe something to consider for the future?)

Footnote

I have not been able to test this for any game other than TF2. I'd be grateful if other people could assist with testing this on different games and engine versions.

This is my first time actively working with C++, so excuse some rookie mistakes.

+246 -0

2 comments

8 changed files

Mikusch

pr closed time in 19 days

issue closedalliedmodders/sourcemod

Bug in smx decompilation

good afternoon guys! during this week I found out that there is a bug in sourcemod where if we make a specific code it is not allowed to decompile to smx I tried everything to try to find this bug where it came from but I didn't get the error that appears when we decompile is ERROR NULL , and no version of sourcemod is created, they simply put the code in the compile and don't let it decompile.

closed time in 20 days

YioLTY1994

issue commentalliedmodders/sourcemod

About HookID of DHooks behaviour

As per the code you linked, freed entries are reused by later created hooks, so the list doesn't actually grow unbounded and hook IDs are not currently globally unique over SRCDS process lifetime.

What issue are you having with the current way hook IDs are implemented / exposed by DHooks?

kice

comment created time in 23 days

issue closedalliedmodders/sourcemod

Updater's SM 1.11 gamedata is missing SetOwnerEntity offset

Help us help you

  • [x] I have checked that my issue doesn't exist yet.
  • [x] I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
  • [x] I can always reproduce the issue with the provided description below.

Environment

  • Game/AppID (with version if applicable): Team Fortress 2
  • Current SourceMod version: 1.11.0.6842
  • Current Metamod: Source snapshot: 1.11.0-dev+1145

Description

The auto-updater's game data seems to be outdated as it's missing the SetOwnerEntity offset, rendering the SetOwnerEntity and SetEntityCollisionGroup natives unusable, unless the gamedata is overridden or the auto-updater is disabled.

Problematic Code (or Steps to Reproduce)

Let SM update the gamedata and check sdktools.games/game.tf.txt, or any gamedata for SetOwnerEntity offset. Offset is missing.

image

closed time in 24 days

KitRifty

issue commentalliedmodders/sourcemod

Updater's SM 1.11 gamedata is missing SetOwnerEntity offset

Thanks, the autoupdater has been updated.

KitRifty

comment created time in 24 days

issue commentalliedmodders/sourcemod

SDKHooks_DropWeapon crashes server

This appears to be a duplicate of #1670, which was fixed in build 6841.

Alexeyt89

comment created time in a month

pull request commentalliedmodders/sourcemod

Add LookupEntityAttachment & GetEntityAttachment natives

@KyleSanderson please could you re-review this or dismiss your stale review.

Mikusch

comment created time in a month

PullRequestReviewEvent

issue commentalliedmodders/sourcemod

Include full SQL query in error log

dvander, rhetorical question: in such case why SM revealed my secret SteamId in above error log. Logging is anyway executed locally. It's a purely problem of user to post on forum logs having secret information without asterisk them firstly.

The error message you see in the log currently is exactly what is provided by the MySQL client library.

dragokas

comment created time in a month

Pull request review commentalliedmodders/sourcemod

Add LookupEntityAttachment & GetEntityAttachment natives

 native void EntityCollisionRulesChanged(int entity);  * @error                   Invalid entity or lack of mod support.
  */
 native void SetEntityOwner(int entity, int owner=INVALID_ENT_REFERENCE);
+
+/**
+ * Returns the index number of a given named attachment.
+ * 
+ * @param entity        The entity index.
+ * @param name          The attachment name.
+ * @return              An attachment index on success, INVALID_ATTACHMENT otherwise.

I feel like we should just specify this returns 0 on failure rather than adding a define for it, we can't type it correctly and code is simpler if it can just check truthiness (which people are going to do anyway with INVALID_ATTACHMENT being 0).

Probably "The attachment index or 0 if the attachment name is invalid or unused"?

Mikusch

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

push eventalliedmodders/sourcemod

naydef

commit sha 7d6eb2bd81323e6c191dacf3b34781b53dc495a0

Fix crash in non-bypass-hooks DropWeapon implementation (#1672) Fixes #1670

view details

push time in a month

PR merged alliedmodders/sourcemod

Fix crash in non-bypass-hooks DropWeapon implementation

Much cleaner

Fixes #1670

+1 -1

1 comment

1 changed file

naydef

pr closed time in a month

issue closedalliedmodders/sourcemod

error?

CRITICAL ERROR 🐕‍🦺 https://github.com/alliedmodders/sourcemod/blob/547ac5b02621a6fdd6dc789a7079ab16a4a82dcf/extensions/sdkhooks/natives.cpp#L299 ???

closed time in a month

UnrealKaraulov
PullRequestReviewEvent
PullRequestReviewEvent
more