summaryrefslogtreecommitdiff
path: root/setup/execute.c
diff options
context:
space:
mode:
authorSimon Howard2006-10-25 18:12:08 +0000
committerSimon Howard2006-10-25 18:12:08 +0000
commit33304ee6ff09806002181e6b739e2a4859be1ade (patch)
tree75c98f8719ea188fa36bf9216854ad69a754b121 /setup/execute.c
parent3fd97506e16b5c6e4f744ebe211d698c3e734619 (diff)
downloadchocolate-doom-33304ee6ff09806002181e6b739e2a4859be1ade.tar.gz
chocolate-doom-33304ee6ff09806002181e6b739e2a4859be1ade.tar.bz2
chocolate-doom-33304ee6ff09806002181e6b739e2a4859be1ade.zip
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
Diffstat (limited to 'setup/execute.c')
-rw-r--r--setup/execute.c25
1 files changed, 24 insertions, 1 deletions
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)