supressing prc loading

I would like to prevent panda from loading any prc at all, both the ones at etc/ and any prc that could be located in my dir. Is this possible?

And in case you are wondering why, the rationale is that I don’t want anybody tinkering with my binary and specifying alternative renderers with wall-hacks and stuff like that. I also don’t want to have problems because I have one prc laying around that I forgot about. I prefer to control everything in the code. Thanks in advance, as always.

Certainly possible if you’re willing to build your own custom build of Panda3D, particularly if you use the ppremake system. There are a number of PRC_* options you can configure in Config.pp that control the reading of prc files. You can even configure it to accept only “signed” prc files, that is, files that you have constructed and signed with a private key that doesn’t get distibuted with your application.

If you aren’t interested in building a custom Panda, you can simply ensure that PANDA_PRC_DIR and PANDA_PRC_PATH are set appropriately at startup.

Of course, nothing will prevent people from tinkering with your binary. It can be argued that making it difficult to do this will only increase people’s motivation to succeed.


From my experience, that’s a nice myth. For example, cheating is absolutely rampant on Warsow (open source shooter) because cheats are so easy to code, more than on any other shooter. I agree with you though, it’s not a final solution but it wasn’t meant to be anyway. But really, it’s mostly about easing support. I don’t want to expend the next 2 years of my life asking everybody that experiences a problem “do you have anything special in your prc?”.

Going back to the matter at hand, yes, I built my own version of panda so I wouldn’t mind making such a change, but I couldn’t find anything called config.pp. Also, are you sure about that? Wouldn’t the code that loads the config files be in a cxx file?

Would you be interested in a patch that adds an option that supresses loading of config files?

Also, I explored the option of the env settings you meantioned. If I set PANDA_PRC_DIR and PANDA_PRC_PATH, won’t Panda still load a prc located in the same dir than the exe? In any case, I tried the following:

void start(int argc, char *argv[]){
    putenv ("PANDA_PRC_DIR=");
    putenv ("PANDA_PRC_PATH=");
    framework.open_framework(argc, argv);

And panda still manages to find the prc in the etc/ folder, so I’m probably misunderstanding something here.

Thanks again for your patience.

You have to set PANDA_PRC_DIR to something nonempty, or it doesn’t count as being set. But it can be set to something that’s not a directory, like “!”. (Debating whether some malicious person might attempt to create a directory named “!” just brings us back where we started.)

However, setting it within the program is too late. The environment variables are consulted (and prc files are read) at static init time, which means you have to set the environment variables before you even launch your application. Precisely how you do that is up to you and your runtime environment.

Config.pp is the input file for ppremake (but not makepanda), and controls all sorts of parameters about the build, including many controls for the prc file system. Among other things, you can easily configure a Panda build that doesn’t read prc files at all. Makepanda doesn’t provide this kind of flexibility, but makepanda was intended to be an easy-to-use build system, not a flexible one.


Actually, let me amend that: you can configure this with makepanda. Examine $DTOOL/Config.pp to read the comments on the various PRC_ variables you can set, then edit to change the same variables defined in the PRC_PARAMETERS dictionary.


Ok, thanks. From a quick look, it seems like the way to go is setting PRC_PATTERNS to an empty string.

For people looking for this, with the latest makepanda on cvs you can do:

makepanda\makepanda.bat --everything --override "PRC_PATTERNS=\"\"" --override "PRC_ENCRYPTED_PATTERNS=\"\""