GameClientRunner Class Reference

Creates command line that launches the client executable of the game and connects it to a server. More...

#include <gameclientrunner.h>

+ Inheritance diagram for GameClientRunner:

Public Member Functions

 GameClientRunner (ServerPtr server)
 
JoinError createJoinCommandLine (CommandLineInfo &cli, const ServerConnectParams &params)
 Fills out CommandLineInfo object that allows client executables to be launched.
 
JoinError joinError () const
 JoinError set by last call to createJoinCommandLine().
 

Protected Member Functions

void addConnectCommand ()
 [Virtual] Adds connection arguments to the list.
 
void addConnectCommand_default ()
 
void addCustomParameters ()
 Adds custom parameters defined by user in configuration box to the args list.
 
void addDemoRecordCommand ()
 Adds command for demo recording.
 
void addExtra ()
 [Virtual] Plugins can easily add plugin-specific arguments here.
 
void addExtra_default ()
 
void addGamePaths ()
 [Virtual] Sets working directory and path to executable in out put CommandLineInfo.
 
void addGamePaths_default ()
 
void addInGamePassword ()
 [Virtual] Adds in-game password to the args list.
 
void addInGamePassword_default ()
 
void addIwad ()
 [Virtual] Plugins can replace IWAD discovery mechanism and generation of relevant executable parameters here.
 
void addIwad_default ()
 
void addModFiles (const QStringList &files)
 Adds path to each game modification file to the args list.
 
void addModFiles_default (const QStringList &files)
 
void addModFiles_prefixOnce (const QStringList &files)
 addModFiles() implementation that sorts files by extension and uses loading prefix arg only once for each extension type.
 
void addPassword ()
 [Virtual] Adds connect password to the args list.
 
void addPassword_default ()
 
void addPwads ()
 Finds and adds each game modification file to the args list, marks missing files.
 
void addWads ()
 Calls addIwad() then addPwads(), sets JoinError::MissingWads in case of failure.
 
const QString & argForBexLoading () const
 
const QString & argForConnect () const
 Command line parameter that specifies the target server's IP and port.
 
const QString & argForConnectPassword () const
 Command line parameter that is used to specify connection password.
 
const QString & argForDehLoading () const
 Command line parameter that is used to load a DEHACKED file.
 
const QString & argForDemoRecord () const
 Command line parameter for recording a demo.
 
const QString & argForInGamePassword () const
 Command line parameter that is used to specify in-game ("join") password.
 
const QString & argForIwadLoading () const
 Command line parameter that is used to set IWAD.
 
const QString & argForOptionalWadLoading () const
 Command line parameter that is used to load optional WADs.
 
const QString & argForPort () const
 Command line parameter that is used to set internet port for the game.
 
const QString & argForPwadLoading () const
 Command line parameter that is used to load a PWAD.
 
QStringList & args ()
 Output command line arguments.
 
const QString & connectPassword () const
 Password for server connection.
 
void createCommandLineArguments ()
 [Virtual] Spawns entire command line for client executable launch.
 
void createCommandLineArguments_default ()
 
const QString & demoName () const
 Name of the demo if demo should be recorded, otherwise empty.
 
QString findWad (const QString &wad) const
 Finds WAD in a way that supports user configured aliases.
 
const QString & inGamePassword () const
 "Join" password required in game.
 
bool isIwadFound () const
 
const QString & iwadPath () const
 
void markPwadAsIncompatible (const PWad &pwadName)
 Stores PWAD in an internal list of incompatible WADs.
 
void markPwadAsMissing (const PWad &pwadName)
 Stores PWAD in an internal list of missing WADs.
 
PathFinderpathFinder ()
 Reference to a PathFinder belonging to this GameClientRunner.
 
ServerConnectParamsserverConnectParams ()
 Direct access to ServerConnectParams associated with current command line generation.
 
void setArgForBexLoading (const QString &arg)
 
void setArgForConnect (const QString &arg)
 
void setArgForConnectPassword (const QString &arg)
 
void setArgForDehLoading (const QString &arg)
 
void setArgForDemoRecord (const QString &arg)
 
void setArgForInGamePassword (const QString &arg)
 
void setArgForIwadLoading (const QString &arg)
 
void setArgForOptionalWadLoading (const QString &arg)
 
void setArgForPort (const QString &arg)
 
void setArgForPwadLoading (const QString &arg)
 
void setExecutable (const QString &path)
 
void setJoinError (const JoinError &e)
 Apply error that is passed to the launching routine and can be displayed to user.
 
void setWorkingDir (const QString &path)
 
QString wadTargetDirectory () const
 Directory where Doomseeker stores downloaded WADs.
 

Detailed Description

Creates command line that launches the client executable of the game and connects it to a server.

Basing on some input parameters object of this class fills out CommandLineInfo objects that can be used to launch games and connect them to game servers. GameClientRunner is connected to a Server object from which it originates and requires for that object to be valid.

Method of command line arguments generation can be customized either partially by replacing one of the virtual methods or fully by replacing createCommandLineArguments() method. In latter case it's entirely up to the plugin to fill out everything either by calling already defined protected methods or by filling out the CommandLineInfo struct on its own.

Definition at line 93 of file gameclientrunner.h.

Member Function Documentation

void GameClientRunner::addConnectCommand ( )
protected

[Virtual] Adds connection arguments to the list.

This is argForConnect() followed by server "ip:port".

void GameClientRunner::addCustomParameters ( )
protected

Adds custom parameters defined by user in configuration box to the args list.

Custom parameters are specified as a single string by the user, but they're split to separate arguments in a manner appropriate to given OS.

Definition at line 189 of file gameclientrunner.cpp.

void GameClientRunner::addDemoRecordCommand ( )
protected

Adds command for demo recording.

This is argForDemoRecord() followed by demoName().

Warning
This method doesn't check whether the demo name is empty and attempts to add the arguments anyway.

Definition at line 197 of file gameclientrunner.cpp.

void GameClientRunner::addExtra ( )
protected

[Virtual] Plugins can easily add plugin-specific arguments here.

This method is called at the end of "add stuff" chain in createCommandLineArguments().

void GameClientRunner::addGamePaths ( )
protected

[Virtual] Sets working directory and path to executable in out put CommandLineInfo.

void GameClientRunner::addInGamePassword ( )
protected

[Virtual] Adds in-game password to the args list.

Adds argForInGamePassword() followed by inGamePassword().

Warning
This method doesn't check whether the password is empty and attempts to add the arguments anyway.
void GameClientRunner::addIwad ( )
protected

[Virtual] Plugins can replace IWAD discovery mechanism and generation of relevant executable parameters here.

This method supports WAD aliasing configured in Doomseeker.

void GameClientRunner::addModFiles ( const QStringList &  files)
protected

Adds path to each game modification file to the args list.

This function is called by addPwads(). Plugins can override this function to implement specific loading behavior for each file. For example, some files might need a different loading pattern or some files might need to be sorted or some might need to be blacklisted.

Default behavior understands .deh and .bex extensions and will apply argForDehLoading() and argForBexLoading() respectively. Other files are loaded with argForPwadLoading(). Each file is prefixed with its respective loading argument. There's an alternative behavior that is unused by default but ready for use by plugins in form of addModFiles_prefixOnce() method.

Parameters
filesPaths to found files.
void GameClientRunner::addModFiles_prefixOnce ( const QStringList &  files)
protected

addModFiles() implementation that sorts files by extension and uses loading prefix arg only once for each extension type.

addModFiles_default() will prefix each file with loading argument like this:

-deh d1.deh -file w1.wad -file p1.pk3 -deh d2.deh -file w2.wad

addModFiles_prefixOnce will produce arguments line like this:

-deh d1.deh d2.deh -file w1.wad p1.pk3 w2.wad

As shown in the example, extension sorting only applies as far as splitting the files into separate loading groups. Sorting of files withing each group is stable. This stable sorting is important as file load order matters within the game!

This method is not used by Doomseeker itself. Plugins may utilize it by setting it with set_addModFiles() method.

Definition at line 327 of file gameclientrunner.cpp.

void GameClientRunner::addPassword ( )
protected

[Virtual] Adds connect password to the args list.

This is argForConnectPassword() followed by connectPassword().

Warning
This method doesn't check whether the password is empty and attempts to add the arguments anyway.
void GameClientRunner::addPwads ( )
protected

Finds and adds each game modification file to the args list, marks missing files.

Properly found files are added to the args list. Each file path is prepended with argForDehLoading(), argForBexLoading() or argForPwadLoading() argument.

Not found files are marked as such with markPwadAsMissing() method.

Paths to found files are forwarded to addModFiles() where they are actually added to the args() list.

This method supports WAD/file aliasing configured in Doomseeker.

Definition at line 298 of file gameclientrunner.cpp.

void GameClientRunner::addWads ( )
protected

Calls addIwad() then addPwads(), sets JoinError::MissingWads in case of failure.

Definition at line 255 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForConnect ( ) const
protected

Command line parameter that specifies the target server's IP and port.

Default: "-connect".

Definition at line 368 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForConnectPassword ( ) const
protected

Command line parameter that is used to specify connection password.

There is no common value here so the default behavior returns a "null" string.

Definition at line 373 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForDehLoading ( ) const
protected

Command line parameter that is used to load a DEHACKED file.

Default: "-deh".

Definition at line 378 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForDemoRecord ( ) const
protected

Command line parameter for recording a demo.

Default: "-record";

Definition at line 408 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForInGamePassword ( ) const
protected

Command line parameter that is used to specify in-game ("join") password.

There is no common value here so the default behavior returns a "null" string.

Definition at line 383 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForIwadLoading ( ) const
protected

Command line parameter that is used to set IWAD.

Default: "-iwad".

Definition at line 388 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForOptionalWadLoading ( ) const
protected

Command line parameter that is used to load optional WADs.

Default: "-file".

Definition at line 393 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForPort ( ) const
protected

Command line parameter that is used to set internet port for the game.

Default: "-port".

Definition at line 398 of file gameclientrunner.cpp.

const QString & GameClientRunner::argForPwadLoading ( ) const
protected

Command line parameter that is used to load a PWAD.

Default: "-file".

Definition at line 403 of file gameclientrunner.cpp.

QStringList & GameClientRunner::args ( )
protected

Output command line arguments.

This is where plugins should write all CMD line arguments they create for the executable run.

Definition at line 358 of file gameclientrunner.cpp.

const QString & GameClientRunner::connectPassword ( ) const
protected

Password for server connection.

Definition at line 418 of file gameclientrunner.cpp.

void GameClientRunner::createCommandLineArguments ( )
protected

[Virtual] Spawns entire command line for client executable launch.

Default behavior splits the call between various "add*" methods. Plugins can customize behavior by either overwriting these "add*" methods that are virtual, or by overwriting this method and either writing the generation process from scratch or reusing the "add*" methods where applicable.

JoinError GameClientRunner::createJoinCommandLine ( CommandLineInfo cli,
const ServerConnectParams params 
)

Fills out CommandLineInfo object that allows client executables to be launched.

Parameters
[out]cliAfter successful call this will contain required command line information.
paramsConnection parameters specified through Doomseeker.
Returns
JoinError::type == NoError if all ok.

Definition at line 444 of file gameclientrunner.cpp.

const QString & GameClientRunner::demoName ( ) const
protected

Name of the demo if demo should be recorded, otherwise empty.

Definition at line 462 of file gameclientrunner.cpp.

QString GameClientRunner::findWad ( const QString &  wad) const
protected

Finds WAD in a way that supports user configured aliases.

Definition at line 472 of file gameclientrunner.cpp.

const QString & GameClientRunner::inGamePassword ( ) const
protected

"Join" password required in game.

Definition at line 515 of file gameclientrunner.cpp.

JoinError GameClientRunner::joinError ( ) const

JoinError set by last call to createJoinCommandLine().

Definition at line 632 of file gameclientrunner.cpp.

void GameClientRunner::markPwadAsIncompatible ( const PWad pwadName)
protected

Stores PWAD in an internal list of incompatible WADs.

This information is retrieved by Doomseeker to prompt user whether they want to try to replace the WADs with compatible ones.

Definition at line 552 of file gameclientrunner.cpp.

void GameClientRunner::markPwadAsMissing ( const PWad pwadName)
protected

Stores PWAD in an internal list of missing WADs.

This information is retrieved by Doomseeker to prompt user whether they want to try to download the WADs.

Definition at line 547 of file gameclientrunner.cpp.

PathFinder & GameClientRunner::pathFinder ( )
protected

Reference to a PathFinder belonging to this GameClientRunner.

Useful if plugins want to access the PathFinder.

Definition at line 557 of file gameclientrunner.cpp.

ServerConnectParams & GameClientRunner::serverConnectParams ( )
protected

Direct access to ServerConnectParams associated with current command line generation.

Definition at line 567 of file gameclientrunner.cpp.

void GameClientRunner::setJoinError ( const JoinError e)
protected

Apply error that is passed to the launching routine and can be displayed to user.

Definition at line 637 of file gameclientrunner.cpp.

QString GameClientRunner::wadTargetDirectory ( ) const
protected

Directory where Doomseeker stores downloaded WADs.

This can be useful for games that support in-game downloads.

Definition at line 647 of file gameclientrunner.cpp.


The documentation for this class was generated from the following files: