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

New feature: poll external file for console commands #1541

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kmeaw
Copy link

@kmeaw kmeaw commented Feb 2, 2022

The commit adds "-refreshfile" and "-refreshinterval" command-line
arguments. Every refreshinterval tics (or once a second if not
specified) a refreshfile is read and is evaluated if exists and not
empty. Then it is truncated.

This feature provides a facility for an external program to control
the game.

Copy link
Member

@coelckers coelckers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't decided yet whether this will be added - but if it will the handling of the file name needs to be changed to be Unicode compatible on all platforms. fopen does not support Unicode on Windows.

@kmeaw
Copy link
Author

kmeaw commented Feb 5, 2022

I have changed the code to use FileReader/FileWriter classes, which use _wfopen if WIN32 is #defined.

@kmeaw kmeaw requested a review from coelckers February 5, 2022 11:16
Copy link
Contributor

@MajorCooke MajorCooke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were some problems when attempting to include this in GZDoom. Was this fully compiled on your end?

if (i > 0 && i < (int)Args->NumArgs() - 1)
{
RefreshFile = Args->GetArgList(i + 1);
RefreshInterval = TICRATE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When trying to merge this into QZDoom, I get the error that TICRATE isn't found.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, when doing this just on GZDoom, TICRATE isn't found. Please fix this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which toolchain are you using? It builds fine on my machine with GCC 11.2.0.
I have just added an #include "doomdef.h" statement in c_console.cpp, it should fix the problem, TICRATE is defined as enum in this file. Please try to reproduce the issue by building 315e58f.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using Visual Studio 2017. I'll try it again in a bit. If it works, then I'll put it in QZDoom.

MajorCooke added a commit to ZDoom/qzdoom that referenced this pull request May 21, 2022
The commit adds "-refreshfile" and "-refreshinterval" command-line
arguments. Every refreshinterval tics (or once a second if not
specified) a refreshfile is read and is evaluated if exists and not
empty. Then it is truncated.

This feature provides a facility for an external program to control
the game.
@madame-rachelle
Copy link
Collaborator

I'm marking this one as "on hold" - I am not going to merge this one until I know for sure that it's okay to do so.

@madame-rachelle
Copy link
Collaborator

This one needs an "ok" from Graf. Functionally it seems this was tested and I was going to go ahead and merge it, but considering the nature of this feature it will need that extra layer of approval.

@CandiceJoy
Copy link
Member

This one needs an "ok" from Graf. Functionally it seems this was tested and I was going to go ahead and merge it, but considering the nature of this feature it will need that extra layer of approval.

Yep, I agree. For what it's worth, I tested it more thoroughly than the others, and it performed flawlessly in all cases; I was actually rather impressed, as I even tried it with a few hundred lines, various refresh intervals, etc.

That being said, I don't know this is the way to go about bringing in commands from outside; that is entirely up to Graf :)

@TancredTerror
Copy link

Hello everybody
The mod TwitchyDoom (https://github.com/CutmanMike/twitchy-doom/blob/main/README.md) can't work anymore since GZDoom didn't manage .txt files as beginning.
Is it possible to fix it please ?

@gamevoin
Copy link

Hello everybody The mod TwitchyDoom (https://github.com/CutmanMike/twitchy-doom/blob/main/README.md) can't work anymore since GZDoom didn't manage .txt files as beginning. Is it possible to fix it please ?

I'd like to see this resolved as well, the mod's been borked past GZDoom 4.10 as it lost the feature to read a constantly updating .txt file.

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

Successfully merging this pull request may close these issues.

7 participants