ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


new:port_detection

This is an old revision of the document!


Port detection

ACSUtils provide a function to detect which engine (source port) it's running on:

int IdentifySourcePort()

Returns one of the following:

  • PORT_ZDOOM
  • PORT_GZDOOM
  • PORT_ZANDRONUM

The following functions are provided for easier use:

  • bool IsGZDoom() – returns true if the mod is running on an engine with GZDoom features (this includes GZDoom and Zandronum).
  • bool IsZandronum() – returns true if the mod is running on Zandronum.

You can also display the name of the port the mod is running in using str GetPortName():

print(s:"This mod is running in ", s:GetPortName());

It returns one of the following: “ZDoom”, “GZDoom”, “Zandronum”.

Renderer detection

ACSUtils also provides a function to check if Software or OpenGL renderer is used:

bool IsOpenGL()

It can only be used clientside. It has several features over checking vid_renderer:

  • It will return false in ZDoom even if vid_renderer is 1, because ZDoom doesn't have an OpenGL renderer. This can happen if a GZDoom config is used in ZDoom.
  • It takes gl_nogl into account, which can disable the OpenGL renderer even if vid_renderer is 1.

How port detection works

First, GetPlayerAccountName(0) is called. In Zandronum it returns a string (possibly empty string). In other ports it returns 0, because it's an unknown function.

Second, existence of DynamicLight actor is checked by spawning and instantly destroying it. This actor is not present in ZDoom. If it spawns successfully, the port is GZDoom.

If both checks fail, the port is ZDoom.

new/port_detection.1518870503.txt.gz · Last modified: 2018/02/17 14:28 by korshun