AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [ANY] SteamWorks (https://forums.alliedmods.net/showthread.php?t=229556)

joao7yt 12-10-2019 21:50

Re: [ANY] SteamWorks
 
It seems like HTTP Requests are not working if they are inside OnPluginStart() and the server is still starting... if I reload the plugin after the server has fully loaded, using "sm plugins reload <pluginName>", then the HTTP Request retrieves the wanted data just fine. It has something to do with the server yet loading when an HTTP Request is called.

I didn't want to use a timer to fix it... Do you know if it's fixable or if there's an alternative to OnPluginStart(), some ServerLoaded() callback?

Lux 12-10-2019 22:54

Re: [ANY] SteamWorks
 
Try this forward
https://sm.alliedmods.net/new-api/so...lPluginsLoaded

KyleS 12-15-2019 23:13

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by joao7yt (Post 2676534)
It seems like HTTP Requests are not working if they are inside OnPluginStart() and the server is still starting... if I reload the plugin after the server has fully loaded, using "sm plugins reload <pluginName>", then the HTTP Request retrieves the wanted data just fine. It has something to do with the server yet loading when an HTTP Request is called.

I didn't want to use a timer to fix it... Do you know if it's fixable or if there's an alternative to OnPluginStart(), some ServerLoaded() callback?

SteamWorks_IsLoaded()? Alternatively SteamWorks_SteamServersConnected().

joao7yt 12-16-2019 08:03

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2677078)
SteamWorks_IsLoaded()? Alternatively SteamWorks_SteamServersConnected().

SteamWorks_SteamServersConnected() did the trick, thanks.

KyleS 12-17-2019 15:35

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by joao7yt (Post 2677108)
SteamWorks_SteamServersConnected() did the trick, thanks.

Remember it's called every time Steam reconnects - use a static or something within the gfwd to only initialize once.

joao7yt 12-17-2019 16:03

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2677249)
Remember it's called every time Steam reconnects - use a static or something within the gfwd to only initialize once.

Thanks. Is there somewhere I can get a full list of SteamWorks callbacks and their descriptions?

KyleS 12-19-2019 20:02

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by joao7yt (Post 2677253)
Thanks. Is there somewhere I can get a full list of SteamWorks callbacks and their descriptions?

The include file and I guess the official Valve documentation. There's a couple internal things but they're mostly documented.

Hiro. 02-01-2020 10:51

Re: [ANY] SteamWorks
 
L 02/01/2020 - 16:34:37: SourceMod error session started
L 02/01/2020 - 16:34:37: Info (map "workshop/1485209481/de_dust2_fo") (file "/data/service8783/data/service_item_1178369/csgo/addons/sourcemod/logs/errors_20200201.log")
L 02/01/2020 - 16:34:37: [SM] Exception reported: This plugin requires one of the cURL, Socket, SteamTools, or SteamWorks extensions to function.
L 02/01/2020 - 16:34:37: [SM] Blaming: updater.smx
L 02/01/2020 - 16:34:37: [SM] Call stack trace:
L 02/01/2020 - 16:34:37: [SM] [0] SetFailState
L 02/01/2020 - 16:34:37: [SM] [1] Line 102, D:\Downloads\Unsorted\sourcemod-1.6.3-windows\addons\sourcemod\scripting\updater.sp ::OnPluginStart
L 02/01/2020 - 16:34:37: [SM] Unable to load plugin "updater.smx": Error detected in plugin startup (see error logs)
L 02/01/2020 - 16:34:37: [SM] Unable to load plugin "CowAntiCheat.smx": Required extension "SteamWorks" file("SteamWorks.ext") not running
L 02/01/2020 - 16:34:41: Error log file session closed.


any help?

paulo_crash 02-01-2020 11:19

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by Hiro. (Post 2682388)
L 02/01/2020 - 16:34:37: SourceMod error session started
L 02/01/2020 - 16:34:37: Info (map "workshop/1485209481/de_dust2_fo") (file "/data/service8783/data/service_item_1178369/csgo/addons/sourcemod/logs/errors_20200201.log")
L 02/01/2020 - 16:34:37: [SM] Exception reported: This plugin requires one of the cURL, Socket, SteamTools, or SteamWorks extensions to function.
L 02/01/2020 - 16:34:37: [SM] Blaming: updater.smx
L 02/01/2020 - 16:34:37: [SM] Call stack trace:
L 02/01/2020 - 16:34:37: [SM] [0] SetFailState
L 02/01/2020 - 16:34:37: [SM] [1] Line 102, D:\Downloads\Unsorted\sourcemod-1.6.3-windows\addons\sourcemod\scripting\updater.sp ::OnPluginStart
L 02/01/2020 - 16:34:37: [SM] Unable to load plugin "updater.smx": Error detected in plugin startup (see error logs)
L 02/01/2020 - 16:34:37: [SM] Unable to load plugin "CowAntiCheat.smx": Required extension "SteamWorks" file("SteamWorks.ext") not running
L 02/01/2020 - 16:34:41: Error log file session closed.


any help?

Install the SteamWorks extension: http://users.alliedmods.net/~kyles/builds/SteamWorks/

Hiro. 02-01-2020 11:32

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by paulo_crash (Post 2682390)

i did, honestly i checked 3 times if i put all the files in, and its there :O

Edit:
altho as i look now in sm exts list, steamworks is not there :(

Edit2:

Nevermind, im an idiot pff, i have a hosted server on linux and i kept downloading windows version, then after 5hrs i remember its linux and not windows.

sorry, im braindead..

JLmelenchon 02-02-2020 15:05

Re: [ANY] SteamWorks
 
I have a similar problem but i installed the linux version on a linux server, was working the other day and it just stopped.

JLmelenchon 02-04-2020 01:05

Re: [ANY] SteamWorks
 
Ok i had to do "sm exts load SteamWorks", why it does not load automatically when server launch ??? I have installed all files.

edit: solved with SteamWorks.autoload file

asherkin 02-04-2020 03:25

Re: [ANY] SteamWorks
 
Extensions are loaded automatically when a plugin needs them, it won’t be loaded unless you have a plugin that wants to use it.

vn_lind 02-11-2020 08:23

Re: [ANY] SteamWorks
 
i tried the latest version on my css server but it crashes the server ,, any ideas what i have missed ?

Vit_amin 02-11-2020 15:49

Re: [ANY] SteamWorks
 
Native SteamWorks_SetGameDescription doesn't work in L4D2, GameDescription doesn't changed

joao7yt 02-16-2020 09:09

Re: [ANY] SteamWorks
 
So, I'm not being able to send a HTTP PUT Request.

Here's my code:

Code:

public Action Event_Round_End_Post(Handle event, const char[]name, bool dontBroadcast)
{
        char link[256];
        Format(link, sizeof(link), "%s/%s", portal_url, match_id);

        char body[512];
        Format(body, sizeof(body), "{\"results\": [{\"team\": \"2\", \"score\": %d}, {\"team\": \"3\", \"score\": %d}]}", GetTeamScore(CS_TEAM_T), GetTeamScore(CS_TEAM_CT));

        Handle req = SteamWorks_CreateHTTPRequest(k_EHTTPMethodPUT, link);
        SteamWorks_SetHTTPRequestHeaderValue(req, "Content-Type", "application/json");
        SteamWorks_SetHTTPRequestRawPostBody(req, "application/json", body, strlen(body)sizeof(body)); // found the mistake, should be strlen() instead of sizeof()
        SteamWorks_SetHTTPCallbacks(req, OnRequestComplete_RoundEnd);
        SteamWorks_SendHTTPRequest(req);
}

public int OnRequestComplete_RoundEnd(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode)
{
        Log("RoundEnd request complete.");

        int length;
        SteamWorks_GetHTTPResponseBodySize(hRequest, length);
        char[] body = new char[length];
        SteamWorks_GetHTTPResponseBodyData(hRequest, body, length);

        Log("Response:");
        Log(body);
}

Here's the response logged:

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>The browser (or proxy) sent a request that this server could not understand.</p>

I have already tried to log the body and copy it to test using Postman, there it works fine. I have checked and the right header is just "Content-Type", "application/json", and my body is JSON format.

Any help is appreciated.

joao7yt 02-17-2020 16:07

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by joao7yt (Post 2684002)
So, I'm not being able to send a HTTP PUT Request.

Here's my code:

Code:

public Action Event_Round_End_Post(Handle event, const char[]name, bool dontBroadcast)
{
        char link[256];
        Format(link, sizeof(link), "%s/%s", portal_url, match_id);

        char body[512];
        Format(body, sizeof(body), "{\"results\": [{\"team\": \"2\", \"score\": %d}, {\"team\": \"3\", \"score\": %d}]}", GetTeamScore(CS_TEAM_T), GetTeamScore(CS_TEAM_CT));

        Handle req = SteamWorks_CreateHTTPRequest(k_EHTTPMethodPUT, link);
        SteamWorks_SetHTTPRequestHeaderValue(req, "Content-Type", "application/json");
        SteamWorks_SetHTTPRequestRawPostBody(req, "application/json", body, sizeof(body));
        SteamWorks_SetHTTPCallbacks(req, OnRequestComplete_RoundEnd);
        SteamWorks_SendHTTPRequest(req);
}

public int OnRequestComplete_RoundEnd(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode)
{
        Log("RoundEnd request complete.");

        int length;
        SteamWorks_GetHTTPResponseBodySize(hRequest, length);
        char[] body = new char[length];
        SteamWorks_GetHTTPResponseBodyData(hRequest, body, length);

        Log("Response:");
        Log(body);
}

Here's the response logged:

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>The browser (or proxy) sent a request that this server could not understand.</p>

I have already tried to log the body and copy it to test using Postman, there it works fine. I have checked and the right header is just "Content-Type", "application/json", and my body is JSON format.

Any help is appreciated.

Found my mistake, I was using 'sizeof(body)' instead of 'strlen(body)'...

Mr.Freeman 03-14-2020 01:38

Re: [ANY] SteamWorks
 
http://users.alliedmods.net/~kyles/builds/SteamWorks/ not working.

asherkin 03-14-2020 11:33

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by Mr.Freeman (Post 2686874)

One of AM's servers is down which is what is causing that outage - it currently looks like it'll be at least the entire weekend.

Kailo 03-14-2020 15:19

Re: [ANY] SteamWorks
 
2 Attachment(s)
"There is no spoon"

cruz99 03-18-2020 14:59

Re: [ANY] SteamWorks
 
can anyone fix the link?

Dr.Mohammad 03-18-2020 22:05

Re: [ANY] SteamWorks
 
hi, this link broken :(

The latest development builds can be found here: http://users.alliedmods.net/~kyles/builds/SteamWorks/

vn_lind 03-19-2020 05:36

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by Dr.Mohammad (Post 2687549)
hi, this link broken :(

The latest development builds can be found here: http://users.alliedmods.net/~kyles/builds/SteamWorks/

SteamWorks-git131-linux.tar.gz crashing my css server .. any idea why ?

BeepIsla 03-26-2020 10:29

Re: [ANY] SteamWorks
 
Code:

EGCResults SteamWorks_GCRetrieveMessage(int punMsgType, const char[] pubDest, int cubDest, int pcubMsgSize)
EGCResults SteamWorks_GCSendMessage(int unMsgType, const char[] pubData, int cubData)

These two seem to be slightly broken, "SteamWorks_GCRetrieveMessage" doesn't work at all and "SteamWorks_GCSendMessage" only works if there is no "SteamWorks_GCRetrieveMessage" forward.

Looking at the source on Github it seems to be the fault of lines 132 and 134.

Code:

this->pGCSendMsg
should be

Code:

this->pGCRetMsg
Attempting to fix and compile this myself made the entire extension not do anything anymore while apparently loading successfully. Maybe something related to what SM/MM/SteamWorks version I compile it against though I tried a few different combinations and none worked.

KyleS 03-31-2020 13:03

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by BeepIsla (Post 2688641)
Code:

EGCResults SteamWorks_GCRetrieveMessage(int punMsgType, const char[] pubDest, int cubDest, int pcubMsgSize)
EGCResults SteamWorks_GCSendMessage(int unMsgType, const char[] pubData, int cubData)

These two seem to be slightly broken, "SteamWorks_GCRetrieveMessage" doesn't work at all and "SteamWorks_GCSendMessage" only works if there is no "SteamWorks_GCRetrieveMessage" forward.

Looking at the source on Github it seems to be the fault of lines 132 and 134.

Code:

this->pGCSendMsg
should be

Code:

this->pGCRetMsg
Attempting to fix and compile this myself made the entire extension not do anything anymore while apparently loading successfully. Maybe something related to what SM/MM/SteamWorks version I compile it against though I tried a few different combinations and none worked.

Thanks for the report, try 132 if you'd like.

BeepIsla 04-03-2020 07:52

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2689673)
Thanks for the report, try 132 if you'd like.

Thanks, sadly this didn't resolve the issue. Everything is the same as before, the forward simply doesn't get executed. I looked a bit more through the code and turns out that line 42 where the "SteamWorks_GCRetrieveMessage" forward is created defines 5 arguments, but in reality there are only 4. Its suppose to be Cell, String, Cell, Cell.

Other than that I don't think there are any more problems, though I could be missing something.

KyleS 04-05-2020 15:45

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by BeepIsla (Post 2690307)
Thanks, sadly this didn't resolve the issue. Everything is the same as before, the forward simply doesn't get executed. I looked a bit more through the code and turns out that line 42 where the "SteamWorks_GCRetrieveMessage" forward is created defines 5 arguments, but in reality there are only 4. Its suppose to be Cell, String, Cell, Cell.

Other than that I don't think there are any more problems, though I could be missing something.

Which game? platform? SM version? MM:S version?

BeepIsla 04-06-2020 06:17

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2691005)
Which game? platform? SM version? MM:S version?

I tried it on CSGO a long time ago on Windows, sadly don't remember the SM & MM versions back then and TF2 most recently on Windows and Linux, both tested with SM 1.11 - build 6522 & MM 1.11 - build 1130. As well as SM 1.10 and MM 1.10 a little bit prior to that.

This simple plugin does not output anything, while NetHook2 clearly says there are incoming GC messages:

Code:

#include <sourcemod>
#include <SteamWorks>

#pragma semicolon 1
#pragma newdecls required

public EGCResults SteamWorks_GCRetrieveMessage(int punMsgType, const char[] pubDest, int cubDest, int pcubMsgSize) {
    LogMessage("SteamWorks_GCRetrieveMessage: %d (%d)", punMsgType, cubDest);
    return k_EGCResultOK;
}


KyleS 04-06-2020 14:08

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by BeepIsla (Post 2691169)
I tried it on CSGO a long time ago on Windows.

Gross. Which version of the Steam Client do you have on the server? if it's ancient it won't have the hooks, thus won't be able to get the interface, and won't be able to hook.

This definitely worked on CSGO at one point as people were intercepting/sending GC messages way back when.

BeepIsla 04-07-2020 10:37

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2691236)
Gross. Which version of the Steam Client do you have on the server? if it's ancient it won't have the hooks, thus won't be able to get the interface, and won't be able to hook.

This definitely worked on CSGO at one point as people were intercepting/sending GC messages way back when.

Sorry but how do I check the Steam version my server is running? Shouldn't SteamCMD and the CSGO/TF2 installation automatically update everything as needed to the latest version?

In the meanwhile I did another test to try and maybe narrow down the problem further:

- Tested on Windows & Ubuntu for both games
- All 64-bit
- All SourceMod 1.11 (build 6522)
- All MetaMod 1.11 (build 1130)
- All updated and validated minutes before doing the test

I added a "SteamWorks_GCSendMessage" and "SteamWorks_GCMsgAvailable" forward to my test plugin and turns out CSGO doesn't log anything at all while TF2 only logs GCMsgAvailable and GCSendMessage but no GCRetrieveMessage, it also repeatedly sends out a GCMessage every 30 seconds for some reason. According to NetHook2 it keeps sending out GCHello messages, Steam sends a GCWelcome back but it seems to get swallowed somewhere.

KyleS 04-07-2020 13:46

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by BeepIsla (Post 2691432)
Sorry but how do I check the Steam version my server is running? Shouldn't SteamCMD and the CSGO/TF2 installation automatically update everything as needed to the latest version?

I guess launch Steam? no idea, the retail setup in that camp has never been good.

Quote:

Originally Posted by BeepIsla (Post 2691432)
I added a "SteamWorks_GCSendMessage" and "SteamWorks_GCMsgAvailable" forward to my test plugin and turns out CSGO doesn't log anything at all while TF2 only logs GCMsgAvailable and GCSendMessage but no GCRetrieveMessage, it also repeatedly sends out a GCMessage every 30 seconds for some reason. According to NetHook2 it keeps sending out GCHello messages, Steam sends a GCWelcome back but it seems to get swallowed somewhere.

That's great and all but you're not really testing what's up. What happens when you call SteamWorks_SendMessageToGC? If you get k_EGCResultNotLoggedOn that may mean the factory isn't available.

BeepIsla 04-09-2020 01:19

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2691525)
I guess launch Steam? no idea, the retail setup in that camp has never been good.

I looked around and the only version identifier I could find was using NetHook2 on my SteamCMD on Windows: client_package_version 1585328668. CSGO/TF2 don't seem to transmit their Steam version anywhere so I can't check it, at least I don't know how.

Quote:

Originally Posted by KyleS (Post 2691525)
That's great and all but you're not really testing what's up. What happens when you call SteamWorks_SendMessageToGC? If you get k_EGCResultNotLoggedOn that may mean the factory isn't available.

"SteamWorks_SendMessageToGC" returns "k_EGCResultOK" for both games on both systems.

A small correction as well: CSGO behaves the same way TF2 does but only if the server is not hibernating. If the CSGO server is hibernating none of the forwards work, this is why I thought it wasn't working.

Both games now repeatedly send out a GC Hello message but Steam's response never reaches the server, it does get logged in "SteamWorks_GCMsgAvailable" though. So I assume "SteamWorks_GCRetrieveMessage" is swallowing the response somewhere.

L3NNyyy 04-18-2020 06:22

Re: [ANY] SteamWorks how to install
 
Hey Ho,

i would really need some help about SteamWorks.

I dont know where to put the Stuffs in my Server. Nothing works....

I would really appreaciate all help i can have.

TiTz 05-02-2020 16:15

Re: [ANY] SteamWorks
 
Hi KyleS,

Is L4D1 supported? as every version of steamworks.ext.dll I try crashes my server.

I've tried all of these - http://users.alliedmods.net/~kyles/builds/SteamWorks/
with these two plugins:

[Any] Veterans Only (v1.0, 2015-01-22)
https://forums.alliedmods.net/showthread.php?t=255871

[ANY] Profile Status
https://forums.alliedmods.net/showthread.php?t=323407

It would be really nice to run these plugins ... hoping you may offer some help with this problem.

Thanks for your time

TiTz

KyleS 05-11-2020 16:22

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by TiTz (Post 2697690)
Hi KyleS,

Is L4D1 supported? as every version of steamworks.ext.dll I try crashes my server.

All 27 builds didn't work for you?

TiTz 05-14-2020 11:18

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2699554)
All 27 builds didn't work for you?

Unfortunately not one ... server would just bomb out no error log :(

vanz 05-14-2020 17:37

Re: [ANY] SteamWorks
 
I looked why SteamWorks_GCRetrieveMessage does not work.
First, the number of arguments in the forward must be 4, instead of 5 (https://github.com/KyleSanderson/Ste...chooks.cpp#L42).
Secondly, we should not call the original function if we did SH_CALL, because the message is removed from the queue and calling the original function again will return k_EGCResultNoMessage.

ImACow 05-28-2020 06:04

Re: [ANY] SteamWorks
 
Since the last CSGO update yesterday ( https://blog.counter-strike.net/inde...2020/05/30199/ )

– Updated Steamworks SDK and Steam libraries to the latest versions released in May 2020.

The SteamWorks_GetPublicIP is returning false and 0,0,0,0
PHP Code:

    int ip[4];
    
bool worked SteamWorks_GetPublicIP(ip)
    
char IPv4[64];
    
Format(IPv4sizeof(IPv4),"%i.%i.%i.%i",ip[0],ip[1],ip[2],ip[3]);
    
ReplyToCommand(client" worked[%b] IPv4[%s]"workedIPv4); 

returns:

PHP Code:

 worked[0IPv4[0.0.0.0

Not sure if its just me.


Also:

PHP Code:

Handle hHTTP_request SteamWorks_CreateHTTPRequest(k_EHTTPMethodGETAPI_URL); 

is returning null,

So I think the gamedata is off?

tuudik 05-28-2020 08:57

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by ImACow (Post 2702746)
Since the last CSGO update yesterday ( https://blog.counter-strike.net/inde...2020/05/30199/ )

– Updated Steamworks SDK and Steam libraries to the latest versions released in May 2020.

The SteamWorks_GetPublicIP is returning false and 0,0,0,0
PHP Code:

    int ip[4];
    
bool worked SteamWorks_GetPublicIP(ip)
    
char IPv4[64];
    
Format(IPv4sizeof(IPv4),"%i.%i.%i.%i",ip[0],ip[1],ip[2],ip[3]);
    
ReplyToCommand(client" worked[%b] IPv4[%s]"workedIPv4); 

returns:

PHP Code:

 worked[0IPv4[0.0.0.0

Not sure if its just me.


Also:

PHP Code:

Handle hHTTP_request SteamWorks_CreateHTTPRequest(k_EHTTPMethodGETAPI_URL); 

is returning null,

So I think the gamedata is off?

Yeah, it seems to be causing issues also to get5: https://github.com/splewis/get5/issues/532

KyleS 05-28-2020 16:07

Re: [ANY] SteamWorks
 
Thanks for the heads up guys. Sucks that this happened again with csgo. I've asked a peer to help me out with updating the SDK on the buildslaves, there might need to be a minor code change but I expect it to be trivial.


All times are GMT -4. The time now is 04:05.

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