[Server] numpr_globals
Posted: Fri Jul 30, 2010 9:04 pm
Not sure if anyone else has posted this...
To extend a progs to support 64k globals instead of a mere 32k is fairly easy.
step 1:
pr_comp.h
find dstatement_t.
change the 'short a, b, c;' line to 'unsigned short a, b, c;'
Well that the gist of it. However, we broke the jump instructions. Those ones need to remain signed.
step 2:
go into pr_exec.c, find the PR_ExecuteProgram function.
find the OP_IF, OP_IFNOT, and OP_GOTO instructions.
OP_GOTO contains the line 's += st->a - 1;' replace it with 's += (signed short)st->a - 1;'
Add a similar cast to the OP_IF and OP_IFNOT instructions as well.
You can now run mods that require 64k globals.
No other changes are required.
To extend a progs to support 64k globals instead of a mere 32k is fairly easy.
step 1:
pr_comp.h
find dstatement_t.
change the 'short a, b, c;' line to 'unsigned short a, b, c;'
Well that the gist of it. However, we broke the jump instructions. Those ones need to remain signed.
step 2:
go into pr_exec.c, find the PR_ExecuteProgram function.
find the OP_IF, OP_IFNOT, and OP_GOTO instructions.
OP_GOTO contains the line 's += st->a - 1;' replace it with 's += (signed short)st->a - 1;'
Add a similar cast to the OP_IF and OP_IFNOT instructions as well.
You can now run mods that require 64k globals.
No other changes are required.