Skip to content

Commit aee1307

Browse files
committed
Mark cgame VM loading options as Cvar::CHEAT
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.
1 parent 4d900d0 commit aee1307

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

daemon/src/engine/framework/VirtualMachine.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5454
#endif
5555

5656
namespace VM {
57+
// Map for each VM to its loading cvar flags.
58+
std::unordered_map<std::string, int> vmCvarFlagsMap = {
59+
{ "cgame", Cvar::CHEAT },
60+
{ "sgame", Cvar::NONE }
61+
};
5762

5863
// Platform-specific code to load a module
5964
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())

daemon/src/engine/framework/VirtualMachine.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,14 @@ enum vmType_t {
8686
TYPE_END
8787
};
8888

89+
extern std::unordered_map<std::string, int> vmCvarFlagsMap;
90+
8991

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

0 commit comments

Comments
 (0)