Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows srcds doesn't obey "-console" flag #3771

Open
Cynosphere opened this issue Feb 24, 2019 · 7 comments
Open

Windows srcds doesn't obey "-console" flag #3771

Cynosphere opened this issue Feb 24, 2019 · 7 comments

Comments

@Cynosphere
Copy link

Details

When launching srcds on Windows, if you have the -console flag in it'll always launch in its own window.
Tested with both plain cmd and cmder/ConEmu.

Steps to reproduce

  • Launch srcds on Windows with -console flag
  • Watch as it opens in a new window instead of sending output to same window
@thegrb93
Copy link

It's always done this. It spawns its own console window.

@neico
Copy link

neico commented Feb 24, 2019

It's always been doing so.
what -console does on windows (unlike on linux, where everything is console by default) is open a CMD window instead of a VGui Window (remember that old green Steam GUI? Yeah, that)

srcds.exe is actually compiled as a "Windowed Application", contrary to a "Console Application"
The difference is that windowed apps don't have a cmd by default, only trough calling AllocConsole() you can make one. (next to the GUI window usually)
If it were a console application it would do what you describe what it should do. (which at the same time would make -console obsolete, and remove the ability to have a VGui window)

Tough changing the type probably won't magically solve it as valve used a lot of (by now) obsolete code mechanics that make the actual console act out of the ordinary, so you'd have to rewrite a not small part of it's inner workings to make it a true console application.

One could probably try to write a alternative exe as the actual dedicated server is stored inside dedicated.dll and not inside srcds.exe which is only a launcher of sorts.

@Cynosphere
Copy link
Author

This is a GMod specific issue though as I've had people try and help me with this and its worked fine for them, which I'm assuming they were using other srcds versions for other games.

@neico
Copy link

neico commented Feb 24, 2019

There are ways to grab stdout and stderr from the window console (called pipe redirecting) and prevent srcds.exe from calling AllocConsole() so it runs within the same cmd (or display it in it's own app, ex. a server watchdog like ServerDoc), but it's rather hacky and I don't think those other people resorted to such methods.

But it is the source1 default behavior of srcds.exe, if it's different somewhere, then someone fiddled with it because he wasn't satisfied with it. (different branches, especially more modern ones like csgo might have it changed)

It's unlikely that FP staff will spend any time on such a trivial thing. (even if I wouldn't mind srcds getting some facelift code-wise to properly expose stdout etc. for easy consumption)

In either case, this is more of a request than a issue (defect).

@mvoolt
Copy link

mvoolt commented Apr 13, 2023

Just a note, Alien Swarm: Reactive Drop has an executable in the root directory of the game named "srcds_console.exe" which doesn't spawn another window and can be freely used across all Source¹ games. (Still requires appending "-console" though)

@Danielboy12345
Copy link

Albeit this does not let it remain in the initial window, running the srcds.exe with the start command closes the prior window, resulting in only one window remaining, rather than two. See the following:

start srcds.exe -console +maxplayers 16 +gamemode %GamemodeID% +map %MapID%

@Cynosphere
Copy link
Author

Albeit this does not let it remain in the initial window

Then there was no point to even commenting on an issue requesting this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants