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

SRCDS windows output redirection


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 09-17-2016 , 22:25   SRCDS windows output redirection
Reply With Quote #1

SRCDS output redirection on windows

Redirecting the server output to a file or other monitoring program wasn't easily possible, because the SRCDS allocated a new console on windows and didn't use the stdout/stdin.

Over at Facepunch, Megalan posted something about "-HFILE -HPARENT -HCHILD" command line options for srcds.exe to redirect the output. After some searching, I've only found references to a long-dead server management tool for Quake 1 called "QHost", for which those parameters were initially added. Luckily they persisted in the engine code until now.

Sadly those parameters aren't exactly for redirecting output, but rather give the possibility to request the last X lines of output and enter some commands from a different program. I wasn't able to really produce a tool that outputs new lines as they appear in the server commandline reliably.
The attached program does output it correctly, but might get confused when the process window gets resized. QHost apparently expected the server console window to always be of 80 width in size and didn't provide an API call to get the current actual size of the window. You might be able to get the size from the process window itself, but my windows-fu isn't strong enough for that (+ lack of interest).

To use this tool, place the SrcdsConRedirect.exe next to the srcds.exe and just call it in place of that - but redirect the output somewhere if you want ;)
Code:
C:\path\to\srcdsserver\SrcdsConRedirect.exe -game cstrike -port 27015 -console +map de_dust2 > console.output
Might be of some use for administration tools like seDirector, so you could send console commands directly to the server without any hacks, just by using the SRCDSControl class in the source package.

The provided methods in the dedicated conproc API are wrapped like
Code:
int GetScreenBufferSize();
bool SetScreenBufferSize(int iLines);
bool WriteText(string input);
string ReadText(int iBeginLine, int iEndLine);
Attached Files
File Type: zip SrcdsConRedirect.zip (16.0 KB, 458 views)
File Type: zip SrcdsConRedirect_src.zip (6.9 KB, 401 views)
__________________

Last edited by Peace-Maker; 09-21-2016 at 14:28. Reason: Update for fast scrolling text
Peace-Maker is offline
 



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 09:10.


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