From 33304ee6ff09806002181e6b739e2a4859be1ade Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 25 Oct 2006 18:12:08 +0000 Subject: Make the "test controls" option work - write the current config to temporary config files and make Doom use these when executing it. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 738 --- setup/execute.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'setup/execute.c') diff --git a/setup/execute.c b/setup/execute.c index 5e8a24ea..fb1ac722 100644 --- a/setup/execute.c +++ b/setup/execute.c @@ -28,6 +28,7 @@ #include "textscreen.h" +#include "configfile.h" #include "execute.h" #include "m_argv.h" @@ -121,6 +122,8 @@ void ExecuteDoom(execute_context_t *context) static void TestCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data)) { execute_context_t *exec; + char *main_cfg; + char *extra_cfg; txt_window_t *testwindow; txt_label_t *label; @@ -131,14 +134,34 @@ static void TestCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data)) TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); TXT_AddWidget(testwindow, label); TXT_DrawDesktop(); - + + // Save temporary configuration files with the current configuration + +#ifdef _WIN32 + main_cfg = "tmp.cfg"; + extra_cfg = "extratmp.cfg"; +#else + main_cfg = "/tmp/tmp.cfg"; + extra_cfg = "/tmp/extratmp.cfg"; +#endif + + M_SaveMainDefaults(main_cfg); + M_SaveExtraDefaults(extra_cfg); + // Run with the -testcontrols parameter exec = NewExecuteContext(); AddCmdLineParameter(exec, "-testcontrols"); + AddCmdLineParameter(exec, "-config %s", main_cfg); + AddCmdLineParameter(exec, "-extraconfig %s", extra_cfg); ExecuteDoom(exec); TXT_CloseWindow(testwindow); + + // Delete the temporary config files + + remove(main_cfg); + remove(extra_cfg); } txt_window_action_t *TestConfigAction(void) -- cgit v1.2.3