Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
engine_info [2019/04/22 00:21] – korshun | engine_info [2019/04/22 00:28] – korshun |
---|
====== Engine information ====== | ====== Source port and renderer identification ====== |
| |
ACSUtils provides functions to identify the exact source port (ZDoom, GZDoom, Zandronum) and renderer (software, OpenGL). | ACSUtils provides functions to identify the exact source port (ZDoom, GZDoom, Zandronum) and renderer (software, OpenGL). |
===== Identifying source port ===== | ===== Identifying source port ===== |
| |
==== Detection methods ==== | ==== Detection method ==== |
| |
The detection module first checks for presence of [[zan>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. | The detection module first checks for presence of [[zan>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. |
''str GetPortName()'' | ''str GetPortName()'' |
| |
Returns the name of the source port as a string, one of ''"ZDoom"'', ''"GZDoom"'', ''""Zandronum"''. | Returns the name of the source port as a string, one of ''"ZDoom"'', ''"GZDoom"'', ''"Zandronum"''. |
| |
=== Example usage === | === Example usage === |
=== Detection method === | === Detection method === |
| |
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. | 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 which has ''vid_renderer=1''. |
| |
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. | 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. |
| |
| The result is not cached in any way, because the renderer can be changed mid-game. |
| |
| <note important>Do not save the result in a variable yourself. Always call ''IsOpenGL'' to check for the renderer, because it can be changed mid-game.</note> |
| |
| |
| |