qboolean PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s);
// LordHavoc: optional runtime bounds checking (speed drain, but worth it for security, on by default - breaks most QCCX features (used by CRMod and others))
-cvar_t prvm_boundscheck = {0, "prvm_boundscheck", "1"};
+cvar_t prvm_boundscheck = {0, "prvm_boundscheck", "1", "enables detection of out of bounds memory access in the QuakeC code being run (in other words, prevents really exceedingly bad QuakeC code from doing nasty things to your computer)"};
// LordHavoc: prints every opcode as it executes - warning: this is significant spew
-cvar_t prvm_traceqc = {0, "prvm_traceqc", "0"};
+cvar_t prvm_traceqc = {0, "prvm_traceqc", "0", "prints every QuakeC statement as it is executed (only for really thorough debugging!)"};
//============================================================================
// mempool handling
return d->ofs*4;
}
+ddef_t* PRVM_ED_FindGlobal(const char *name);
+int PRVM_ED_FindGlobalOffset(const char *global)
+{
+ ddef_t *d;
+ d = PRVM_ED_FindGlobal(global);
+ if (!d)
+ return 0;
+ return d->ofs*4;
+}
+
qboolean PRVM_ProgLoaded(int prognr)
{
if(prognr < 0 || prognr >= PRVM_MAXPROGS)
<Spike> SafeWrite (h, statement_linenums, numstatements*sizeof(int));
*/
if( (unsigned) filesize < (6 + prog->progs->numstatements) * sizeof( int ) ) {
- return;
+ Mem_Free(lno);
+ return;
}
header = (unsigned int *) lno;
PRVM_ERROR("PRVM_LoadProgs: out of bounds global index (statement %d) in %s", i, PRVM_NAME);
break;
default:
- PRVM_ERROR("PRVM_LoadProgs: unknown opcode %d at statement %d in %s", st->op, i, PRVM_NAME);
+ Con_DPrintf("PRVM_LoadProgs: unknown opcode %d at statement %d in %s", st->op, i, PRVM_NAME);
break;
}
}
*/
void PRVM_Init (void)
{
- Cmd_AddCommand ("prvm_edict", PRVM_ED_PrintEdict_f);
- Cmd_AddCommand ("prvm_edicts", PRVM_ED_PrintEdicts_f);
- Cmd_AddCommand ("prvm_edictcount", PRVM_ED_Count_f);
- Cmd_AddCommand ("prvm_profile", PRVM_Profile_f);
- Cmd_AddCommand ("prvm_fields", PRVM_Fields_f);
- Cmd_AddCommand ("prvm_globals", PRVM_Globals_f);
- Cmd_AddCommand ("prvm_global", PRVM_Global_f);
- Cmd_AddCommand ("prvm_globalset", PRVM_GlobalSet_f);
- Cmd_AddCommand ("prvm_edictset", PRVM_ED_EdictSet_f);
+ Cmd_AddCommand ("prvm_edict", PRVM_ED_PrintEdict_f, "print all data about an entity number in the selected VM (server, client, menu)");
+ Cmd_AddCommand ("prvm_edicts", PRVM_ED_PrintEdicts_f, "set a property on an entity number in the selected VM (server, client, menu)");
+ Cmd_AddCommand ("prvm_edictcount", PRVM_ED_Count_f, "prints number of active entities in the selected VM (server, client, menu)");
+ Cmd_AddCommand ("prvm_profile", PRVM_Profile_f, "prints execution statistics about the most used QuakeC functions in the selected VM (server, client, menu)");
+ Cmd_AddCommand ("prvm_fields", PRVM_Fields_f, "prints usage statistics on properties (how many entities have non-zero values) in the selected VM (server, client, menu)");
+ Cmd_AddCommand ("prvm_globals", PRVM_Globals_f, "prints all global variables in the selected VM (server, client, menu)");
+ Cmd_AddCommand ("prvm_global", PRVM_Global_f, "prints value of a specified global variable in the selected VM (server, client, menu)");
+ Cmd_AddCommand ("prvm_globalset", PRVM_GlobalSet_f, "sets value of a specified global variable in the selected VM (server, client, menu)");
+ Cmd_AddCommand ("prvm_edictset", PRVM_ED_EdictSet_f, "changes value of a specified property of a specified entity in the selected VM (server, client, menu)");
// LordHavoc: optional runtime bounds checking (speed drain, but worth it for security, on by default - breaks most QCCX features (used by CRMod and others))
Cvar_RegisterVariable (&prvm_boundscheck);
Cvar_RegisterVariable (&prvm_traceqc);
if (prog->knownstrings[i] == s)
return -1 - i;
// new unknown engine string
- if (developer.integer >= 3)
+ if (developer.integer >= 100)
Con_Printf("new engine string %p\n", s);
for (i = prog->firstfreeknownstring;i < prog->numknownstrings;i++)
if (!prog->knownstrings[i])