diff options
author | Simon Howard | 2006-10-25 18:12:08 +0000 |
---|---|---|
committer | Simon Howard | 2006-10-25 18:12:08 +0000 |
commit | 33304ee6ff09806002181e6b739e2a4859be1ade (patch) | |
tree | 75c98f8719ea188fa36bf9216854ad69a754b121 /setup/execute.c | |
parent | 3fd97506e16b5c6e4f744ebe211d698c3e734619 (diff) | |
download | chocolate-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.c | 25 |
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) |