summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2006-10-25 18:12:08 +0000
committerSimon Howard2006-10-25 18:12:08 +0000
commit33304ee6ff09806002181e6b739e2a4859be1ade (patch)
tree75c98f8719ea188fa36bf9216854ad69a754b121
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
-rw-r--r--setup/configfile.c44
-rw-r--r--setup/configfile.h3
-rw-r--r--setup/display.c2
-rw-r--r--setup/execute.c25
4 files changed, 72 insertions, 2 deletions
diff --git a/setup/configfile.c b/setup/configfile.c
index 6042d318..f974f043 100644
--- a/setup/configfile.c
+++ b/setup/configfile.c
@@ -533,3 +533,47 @@ void M_LoadDefaults (void)
LoadDefaultCollection(&extra_defaults);
}
+//
+// Save normal (default.cfg) defaults to a given file
+//
+
+void M_SaveMainDefaults(char *filename)
+{
+ char *main_filename;
+
+ // Save the normal filename and set this one
+
+ main_filename = doom_defaults.filename;
+ doom_defaults.filename = filename;
+
+ // Save the file
+
+ SaveDefaultCollection(&doom_defaults);
+
+ // Restore the normal filename
+
+ doom_defaults.filename = main_filename;
+}
+
+//
+// Save extra (chocolate-doom.cfg) defaults to a given file
+//
+
+void M_SaveExtraDefaults(char *filename)
+{
+ char *main_filename;
+
+ // Save the normal filename and set this one
+
+ main_filename = extra_defaults.filename;
+ extra_defaults.filename = filename;
+
+ // Save the file
+
+ SaveDefaultCollection(&extra_defaults);
+
+ // Restore the normal filename
+
+ extra_defaults.filename = main_filename;
+}
+
diff --git a/setup/configfile.h b/setup/configfile.h
index 63113cc1..f7c6156e 100644
--- a/setup/configfile.h
+++ b/setup/configfile.h
@@ -35,5 +35,8 @@ void M_SaveDefaults (void);
void M_SetConfigDir(void);
+void M_SaveMainDefaults(char *filename);
+void M_SaveExtraDefaults(char *filename);
+
#endif
diff --git a/setup/display.c b/setup/display.c
index cecd7e12..c494ebe5 100644
--- a/setup/display.c
+++ b/setup/display.c
@@ -49,7 +49,7 @@ static vidmode_t modes[] =
static int vidmode = 0;
int autoadjust_video_settings = 1;
-int fullscreen = 0;
+int fullscreen = 1;
int screenmultiply = 1;
int startup_delay = 0;
int show_endoom = 1;
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)