Skip to main content

Module core

Module core 

Source
Expand description

Bindings for the ILogger interface of ICore (Open Multiplayer).

ICore inherits from IExtensible and ILogger (ICore : public IExtensible, public ILogger). As multiple inheritance, ILogger is a secondary base class with its own vtable, located after the IExtensible subobject.

§Offsets (both confirmed via disasm of Console.dll / Console.so)

  • MSVC i686 (Console.dll): lea edx, [core+0x38]; mov ecx, [edx]; call [ecx+8] -> ILogger at offset 56
  • Linux GCC i686 / Itanium (Console.so): add edi, 0x28; mov ebx, [edi]; call [ebx+8] -> ILogger at offset 40

In both, slot[2] is logLn — matches the order declared in core.hpp:151-184.

§ILogger vtable (order defined in core.hpp:151-184)

[0] printLn(fmt, ...)         — print without level
[1] vprintLn(fmt, va_list)
[2] logLn(level, fmt, ...)    — print with LogLevel
[3] vlogLn(level, fmt, va_list)
[4] printLnU8(fmt, ...)       — UTF-8 variants
[5] vprintLnU8(fmt, va_list)
[6] logLnU8(level, fmt, ...)
[7] vlogLnU8(level, fmt, va_list)

§Calling convention

Variadic virtual methods on x86 use __cdecl on both MSVC and Itanium (thiscall does not support varargs). this is the first arg pushed on the stack; the caller is responsible for cleaning the stack.

Since stable Rust does not support extern "C" variadic (the c_variadic feature is nightly), we declare the functions with a fixed arity of 1 arg and use the format "%s": the caller formats the message in Rust (format!) and passes the resulting CString as the single variadic argument. The ABI is identical to that of the C variadic function — printf("%s", msg) is equivalent to printf(msg) for the calling convention.

Enums§

LogLevel
Open Multiplayer log level (corresponds to LogLevel in core.hpp).

Functions§

core_log_ln
ICore::logLn(level, message) — writes a line with a log level.
core_log_ln_u8
ICore::logLnU8(level, message) — UTF-8 variant of logLn.
core_print_ln
ICore::printLn(message) — writes a line to the server log.
core_print_ln_u8
ICore::printLnU8(message) — UTF-8 variant of printLn.