Skip to content

Commit

Permalink
Mark cgame VM loading options as Cvar::CHEAT
Browse files Browse the repository at this point in the history
This forces you to use the VM in the pk3. This ensures
you never have a mismatch with the server you are
connecting to. You can continue to use exotic options
for loading sgame VMs.
  • Loading branch information
DolceTriade committed Jan 2, 2016
1 parent 4d900d0 commit aee1307
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions daemon/src/engine/framework/VirtualMachine.cpp
Expand Up @@ -54,6 +54,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif #endif


namespace VM { namespace VM {
// Map for each VM to its loading cvar flags.
std::unordered_map<std::string, int> vmCvarFlagsMap = {
{ "cgame", Cvar::CHEAT },
{ "sgame", Cvar::NONE }
};


// Platform-specific code to load a module // Platform-specific code to load a module
static std::pair<Sys::OSHandle, IPC::Socket> InternalLoadModule(std::pair<IPC::Socket, IPC::Socket> pair, const char* const* args, bool reserve_mem, FS::File stderrRedirect = FS::File()) static std::pair<Sys::OSHandle, IPC::Socket> InternalLoadModule(std::pair<IPC::Socket, IPC::Socket> pair, const char* const* args, bool reserve_mem, FS::File stderrRedirect = FS::File())
Expand Down
6 changes: 4 additions & 2 deletions daemon/src/engine/framework/VirtualMachine.h
Expand Up @@ -86,12 +86,14 @@ enum vmType_t {
TYPE_END TYPE_END
}; };


extern std::unordered_map<std::string, int> vmCvarFlagsMap;



struct VMParams { struct VMParams {
VMParams(std::string name) VMParams(std::string name)
: logSyscalls("vm." + name + ".logSyscalls", "dump all the syscalls in the " + name + ".syscallLog file", Cvar::NONE, false), : logSyscalls("vm." + name + ".logSyscalls", "dump all the syscalls in the " + name + ".syscallLog file", Cvar::NONE, false),
vmType("vm." + name + ".type", "how the vm should be loaded for " + name, Cvar::NONE, TYPE_NACL, 0, TYPE_END - 1), vmType("vm." + name + ".type", "how the vm should be loaded for " + name, vmCvarFlagsMap[name], TYPE_NACL, 0, TYPE_END - 1),
debug("vm." + name + ".debug", "run a gdbserver on localhost:4014 to debug the VM", Cvar::NONE, false), debug("vm." + name + ".debug", "run a gdbserver on localhost:4014 to debug the VM", vmCvarFlagsMap[name], false),
debugLoader("vm." + name + ".debugLoader", "make nacl_loader dump information to " + name + "-nacl_loader.log", Cvar::NONE, 0, 0, 5) { debugLoader("vm." + name + ".debugLoader", "make nacl_loader dump information to " + name + "-nacl_loader.log", Cvar::NONE, 0, 0, 5) {
} }


Expand Down

0 comments on commit aee1307

Please sign in to comment.