This is an old revision of the document!
ACSUtils provides functions to identify the exact source port (ZDoom, GZDoom, Zandronum) and renderer (software, OpenGL).
The detection module first checks for presence of GetPlayerAccountName, which is a Zandronum-exclusive function. It returns a string (usually an empty string) if it exists, while unimplemented ACS functions return 0. If the function is present, the port is assumed to be Zandronum.
If the port is not Zandronum, the detection module attempts to spawn an actor of type DynamicLight, which is present in GZDoom, but not in ZDoom. If the actor spawns successfully, the port is assumed to be GZDoom.
If both these checks fail, the port is assumed to be ZDoom.
The above checks are not rerun every time the source port is queried. After identification, the type of the source port is saved into a map variable. Subsequent queries simply return the value of that variable.
int IdentifySourcePort()
Identifies the engine that the mod is running in and returns one of the following constants:
PORT_ZDOOM
– ZDoomPORT_GZDOOM
– GZDoomPORT_ZANDRONUM
– Zandronum
bool IsGZDoom()
Returns true if the port is GZDoom or a derivative.
IsOpenGL
.
bool IsZandronum()
Returns true if the port is Zandronum or a derivative.
str GetPortName()
Returns the name of the source port as a string, one of “ZDoom”
, “GZDoom”
, ““Zandronum”
.
print(s:"This mod is running on ", s:GetPortName());
bool IsOpenGL()
Returns true if the engine is currently running in an OpenGL renderer.
This function first calls IsGZDoom
to check if the port is GZDoom or a derivative like Zandronum. If the port is not a GZDoom derivative, it can't have the OpenGL renderer, and this function returns false. This is to prevent detecting the OpenGL renderer when ZDoom is run with a config from GZDoom.
If the port is confirmed to be a GZDoom derivative, this function checks for two CVars: vid_renderer
and gl_nogl
. This function only returns true if vid_renderer
is true and gl_nogl
is false.