Skip to content

Debug

A set of debugging and error-handling functions for mod development with Ikarus.

Initialization

The best way to initialize all Ikarus functions is to call MEM_InitAll() in the Init_Global() initialization function.

Warning

If you want to use Ikarus in Gothic 1, it is best to define your own Init_Global() function and call it from every world initialization function.

MEM_InitAll();

Implementation

Ikarus.d on GitHub

Functions

MEM_CheckVersion

MEM_CheckVersion

Checks if the version of Ikarus is the specified version or newer.

func int MEM_CheckVersion(var int base, var int major, var int minor)
Parameters
  • var int base
    Base version number
  • var int major
    Major revision number
  • var int minor
    Minor revision number

Return value

The function returns TRUE if the version of Ikarus is the specified version or newer, FALSE is returned otherwise.

MEM_SetShowDebug

MEM_SetShowDebug

Sets the variable that is also toggled by the toggle debug command. As a result, messages outputted by PrintDebug are directed to the zSpy

func void MEM_SetShowDebug(var int on)
Parameters
  • var int on
    Specifies whether to turn on (TRUE) or off (FALSE) debug information.

MEM_SendToSpy

MEM_SendToSpy

Sends a message to the debugging console.

func void MEM_SendToSpy(var int errorType, var string text)
Parameters
  • var int errorType
    Type of error (e.g., zERR_TYPE_FAULT, zERR_TYPE_WARN, zERR_TYPE_INFO)
  • var string text
    The message to be sent.

MEM_ErrorBox

MEM_ErrorBox

Displays an error message in a message box.

func void MEM_ErrorBox(var string text)
Parameters
  • var string text
    The error message to be displayed.

MEM_PrintStackTrace

MEM_PrintStackTrace

Prints the stack trace.

func void MEM_PrintStackTrace()

MEM_Error

MEM_Error

Handles a fatal error, displaying the error message and printing the stack trace.

func void MEM_Error(var string error)
Parameters
  • var string error
    The error message.

MEM_Warn

MEM_Warn

Handles a warning, displaying the warning message and printing the stack trace.

func void MEM_Warn(var string warn)
Parameters
  • var string warn
    The warning message.

MEM_Info

MEM_Info

Handles an information message, printing it if enabled in the settings.

func void MEM_Info(var string info)
Parameters
  • var string info
    The information message.

MEM_AssertFail

MEM_AssertFail

Handles an assertion failure, reporting the error message as a fatal error.

func void MEM_AssertFail(var string assertFailText)
Parameters
  • var string assertFailText
    The assertion failure message.

MEM_Debug

MEM_Debug

Freely configurable debug channel. See how to setup it in the Constants article.

func void MEM_Debug(var string message)
Parameters
  • var string message
    The debug message.

MEMINT_SwitchG1G2

MEMINT_SwitchG1G2

Switches between values based on the game version. Used mainly to change addresses in multi-platform hooks or function calls.

func int MEMINT_SwitchG1G2(var int g1Val, var int g2Val)
Parameters
  • var int g1Val The value to return if the game version is Gothic 1.
  • var int g2Val
    The value to return if the game version is Gothic 2.

Return value

The function returns an appropriate value based on the game version.