XENON SDK

Function Signatures

int main(void)

This is the entry point signature the Xenon SDK expects for all traditional games. Contrary to wikis that claim

void main(void)
or
int main(int argc, char *argv[])
, the signature only takes a void parameter and returns an integer.

void mainCRTStartup(void)

This is similar to Windows' mainCRTStartup function, but tailored for the 360. It internally sets up argv and argc but does not pass them to user code.

XamLoaderTerminateTitle(DbgPrint("[XAPI RETURN VALUE] %d\n",main_int))
happens on termination.

void XamLoaderTerminateTitle(UINT ExitCode)

This function is used to terminate the title and return control to the dashboard. The parameter is an unsigned integer exit code that can be used for debugging or signaling purposes.

LPVOID XPhysicalAllocEx(SIZE_T dwSize, LPVOID lpLowAddress, LPVOID lpHighAddress, DWORD dwAlignment, DWORD flAllocationType)

This function is used to allocate physical memory on the Xbox 360. The parameters are as follows:

[in] dwSize
The size of the memory block to allocate, in bytes.
[in] lpLowAddress
The lowest acceptable address for the allocation. This parameter is optional and can be set to NULL.
[in] lpHighAddress
The highest acceptable address for the allocation. This parameter is optional and can be set to NULL.
[in] dwAlignment
The alignment for the allocation. This parameter is optional and can be set to 0 for default alignment. Must be a power of 2.
[in] flAllocationType
The type of allocation. This parameter is optional and can be set to 0 for default allocation.

The 360 did not have a modern concept of paging.

void XPhysicalFree(LPVOID lpAddress)

This function is used to free physical memory that was previously allocated with XPhysicalAllocEx. The parameter is as follows:

[in] lpAddress
A pointer to the base address of the memory block to be freed. This should be the same address that was returned by XPhysicalAllocEx.