Fixes two cvars being writable that shouldn't be.
Fixes MVM getgamedirinfo() builtin returning stale data (wasn't updated
by fs_rescan).
Fixes `startdemos` not working when changing to a mod that uses it,
after previously having had a map loaded.
Fixes `menu_main` being unavailable to quake.rc when changing to a mod
that uses it instead of `startdemos`.
Fixes `menu_restart` not performing the full MR_Init() (updates video
modes etc).
Fixes a race where it was possible to segfault by handling keyboard
events meant for MENU QC after MR_Shutdown() but before MR_Init() (by
calling directly instead of adding `menu_restart` to the cbuf).
Fixes an inconsistent extern declaration found by ubsan.
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
extern cvar_t host_framerate;
extern cvar_t host_speeds;
-extern qbool serverlist_querystage;
+extern uint8_t serverlist_querystage;
double CL_Frame (double time)
{
static double clframetime;
/// called by Host_Init, this marks cvars, commands and aliases with their init values
void Cmd_SaveInitState(void);
-/// called by FS_GameDir_f, this restores cvars, commands and aliases to init values
+/// Restores cvars, commands and aliases to their init values
+/// and deletes any that were added since init.
void Cmd_RestoreInitState(void);
/// called by the init functions of other parts of the program to
#include "quakedef.h"
#include "utf8lib.h"
-cvar_t registered = {CF_CLIENT | CF_SERVER, "registered","0", "indicates if this is running registered quake (whether gfx/pop.lmp was found)"};
-cvar_t cmdline = {CF_CLIENT | CF_SERVER, "cmdline","0", "contains commandline the engine was launched with"};
+cvar_t registered = {CF_CLIENT | CF_SERVER | CF_READONLY, "registered","0", "indicates if this is running registered quake (whether gfx/pop.lmp was found)"};
+cvar_t cmdline = {CF_CLIENT | CF_SERVER | CF_READONLY, "cmdline","0", "contains commandline the engine was launched with"};
// FIXME: Find a better place for these.
cvar_t cl_playermodel = {CF_CLIENT | CF_SERVER | CF_USERINFO | CF_ARCHIVE, "playermodel", "", "current player model in Nexuiz/Xonotic"};
FS_Rescan
================
*/
+static void FS_ListGameDirs(void);
void FS_Rescan (void)
{
int i;
char gamedirbuf[MAX_INPUTLINE];
char vabuf[1024];
+ FS_ListGameDirs();
+
FS_ClearSearchPath();
// update the com_modname (used for server info)
Host_SaveConfig(CONFIGFILENAME);
if (cls.demoplayback)
- {
CL_Disconnect();
- cls.demonum = 0;
- }
+ cls.demonum = 0; // make sure startdemos will work if the mod uses it
// unload all sounds so they will be reloaded from the new files as needed
S_UnloadAllSounds_f(cmd_local);
FS_Rescan();
// reload assets after the config is executed
- Cbuf_InsertText(cmd_local, "\nloadconfig\n");
+ Cbuf_InsertText(cmd_local, "\nloadconfig\nr_restart\n");
return true;
}
if (!strcmp(fs_basedir, fs_userdir))
fs_userdir[0] = 0;
- FS_ListGameDirs();
-
// -game <gamedir>
// Adds basedir/gamedir as an override game
// LadyHavoc: now supports multiple -game directories
// Xonotic QC complains/breaks if its cvars are deleted before its m_shutdown() is called
if(MR_Shutdown)
MR_Shutdown();
- // append a menu restart command to execute after the config
- Cbuf_AddText(cmd, "\nmenu_restart\n");
#endif
- // reset all cvars, commands and aliases to init values
Cmd_RestoreInitState();
- // reset cvars to their defaults, and then exec startup scripts again
+#ifdef CONFIG_MENU
+ // Must re-add menu.c commands or load menu.dat before executing quake.rc or handling events
+ MR_Init();
+#endif
+ // exec startup scripts again
Host_AddConfigText(cmd);
}
{
if(MR_Shutdown)
MR_Shutdown ();
- MR_SetRouting (false);
+ MR_Init();
}
static void MR_Restart_f(cmd_state_t *cmd)