28 | | TODO: put text here. |
| 28 | Edit these files: |
| 29 | |
| 30 | * '''game/g_public.h''': add an element to the gameImport_t enum (order matters - try to maintain the values of all the other entries (just add at the bottom)). |
| 31 | * '''game/g_local.h''': add trap function declarations (see bottom of file). These will be the function names inside the VM. |
| 32 | * '''game/g_syscalls.asm''': add equ statements to the file reflecting the (negative) value of the enum entry you added. It should be off by one like all the others are. |
| 33 | * '''game/g_syscalls.c''': add a patch function that calls syscall with the appropriate enum value and parameters, and returns what it returns unless the return is void. |
| 34 | * '''qcommon/q_shared.h''': add trap function declarations (search "Quagents" and keep them together). These will be the function names outside the VM. |
| 35 | * '''qcommon/common.c''': we've defined all our trap functions here, but you probably don't ''have'' to. Still, it's a convenient place to do it, so why don't we keep them together and define the function here. |
| 36 | * '''server/sv_game.c''': edit SV_GameSystemCalls and add a case for your enum value to call your function with. If you're passing memory addresses out of the virtual machine, use VMA(x) to remap address in args[x] from VM-memory to Quake-memory. Keep in mind that there's no way to go the other way - you won't be able to see memory outside the VM from within it. |