resonance 1.0.1
Loading...
Searching...
No Matches
Py::MethodTable Class Reference

Accumulator for the method table of an extension module. More...

#include <methodtable.h>

Public Member Functions

 MethodTable ()
 Start with the terminator record alone.
virtual ~MethodTable ()
 Release the flattened table.
void add (const char *pszMethodName, PyCFunction pfnMethod, const char *pszDoc="", int nFlags=1)
 Append one method ahead of the terminator.
PyMethodDef * table ()
 Flatten the records into an array the interpreter can retain.

Detailed Description

Accumulator for the method table of an extension module.

Its RTTI descriptor is at 0x0086f688. It has no base. The object is 0x14 bytes, the vector at +0x00, the flattened table at +0x0c, and the vptr after both at +0x10. This compiler places the vptr of a class with no base after the data.

The vtable at 0x00833210 has two entries.

Slot Member Address
0 compiler-generated type function 0x005ab9d0
1 ~MethodTable 0x005abb68

The one instance in the image is the function-local static behind the RegisterCFunction constructor. The game registers every script function exported to Python through that constructor.

Constructor & Destructor Documentation

◆ MethodTable()

Py::MethodTable::MethodTable ( )
inline

Start with the terminator record alone.

Ghidra address:
NTSC-U/C: 0x005a5aa8
Ghidra address:
PAL: 0x005e7f78

◆ ~MethodTable()

virtual Py::MethodTable::~MethodTable ( )
inlinevirtual

Release the flattened table.

Ghidra address:
NTSC-U/C: 0x005abb68
Ghidra address:
PAL: 0x005ee090

Member Function Documentation

◆ add()

void Py::MethodTable::add ( const char * pszMethodName,
PyCFunction pfnMethod,
const char * pszDoc = "",
int nFlags = 1 )
inline

Append one method ahead of the terminator.

Appending after table() has run is refused, because the flattened copy is what the interpreter already holds.

Parameters
pszMethodNameThe Python-visible name.
pfnMethodThe C entry point.
pszDocThe doc string.
nFlagsThe calling convention flag.
Ghidra address:
NTSC-U/C: 0x005a5bc8
Ghidra address:
PAL: 0x005e8098

◆ table()

PyMethodDef * Py::MethodTable::table ( )
inline

Flatten the records into an array the interpreter can retain.

The array is built once and reused, and that is also what closes the table to further additions.

Returns
The array, terminated by the record the constructor placed.
Ghidra address:
NTSC-U/C: 0x005abc98
Ghidra address:
PAL: 0x005ee1c0

The documentation for this class was generated from the following file: