1.3 PSYX Calling Conventions
main()
function) a pGetFuncTable
message (see below); the PSYX can respond by returning a pointer to a table that matches message IDs with function pointers.
If a PSYX returns a message table, the PSYX manager will thereafter check the table before sending messages through main()
; messages with IDs found in the table will be sent directly to the designated functions, instead of to main()
.
Any message can be handled through the message table instead of the main()
function (except for the pGetFuncTable, pInitialize, and pDeinitialize
messages). However, some messages may be required to have an entry in the message table. Usually, this is the case for messages that are sent often or should be handled as fast as possible. Unless a message's description specifies otherwise, you can assume that it is not required to have a table entry.
As with the main()
function, parameters are passed to message table functions using C-style function-calling. However, the function prototype may be different for different messages.
If the message can be handled in the main()
function, then it will always have a prototype of the form:
void MsgHandler(int mod, void *msgData, long id);These are the same parameters that are passed to the
main()
function (after the message ID). In practice, the pointer parameter msgData
is usually declared with a more specific type, appropriate to the message handled by the function.
As mentioned in "1.3.1.2 Stand-alone code resources", the A4 register is maintained by PsyScope even when a message is sent though the message table. If a client of the PSYX manager requests a function pointer from some PSYX's message table (using FillInFunctionList()
), the PSYX manager replies with a function containing glue to automatically set up and restore A4.
Generated with CERN WebMaker