summaryrefslogtreecommitdiff
path: root/src/setup
diff options
context:
space:
mode:
Diffstat (limited to 'src/setup')
-rw-r--r--src/setup/Makefile.am6
-rw-r--r--src/setup/display.c221
-rw-r--r--src/setup/joystick.c3
-rw-r--r--src/setup/setup-manifest.xml.in25
-rw-r--r--src/setup/setup.desktop.in7
-rw-r--r--src/setup/sound.c2
-rw-r--r--src/setup/txt_joybinput.c21
-rw-r--r--src/setup/txt_joybinput.h1
-rw-r--r--src/setup/txt_keyinput.c21
-rw-r--r--src/setup/txt_keyinput.h1
-rw-r--r--src/setup/txt_mouseinput.c20
-rw-r--r--src/setup/txt_mouseinput.h1
12 files changed, 218 insertions, 111 deletions
diff --git a/src/setup/Makefile.am b/src/setup/Makefile.am
index 25ab38e3..7fe051ee 100644
--- a/src/setup/Makefile.am
+++ b/src/setup/Makefile.am
@@ -27,6 +27,12 @@ libsetup_a_SOURCES = $(SOURCE_FILES)
EXTRA_DIST= \
setup_icon.c
+appdir = $(prefix)/share/applications
+app_DATA = @PROGRAM_PREFIX@setup.desktop
+
+@PROGRAM_PREFIX@setup.desktop : setup.desktop
+ cp $^ $@
+
if HAVE_PYTHON
setup_icon.c : $(top_builddir)/data/setup8.ico
diff --git a/src/setup/display.c b/src/setup/display.c
index 9ed0ae5f..72f3c057 100644
--- a/src/setup/display.c
+++ b/src/setup/display.c
@@ -527,25 +527,34 @@ static void UpdateBPP(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(modes_table))
GenerateModesTable(NULL, modes_table);
}
-#if defined(_WIN32) && !defined(_WIN32_WCE)
+static void UpdateModeSeparator(TXT_UNCAST_ARG(widget),
+ TXT_UNCAST_ARG(separator))
+{
+ TXT_CAST_ARG(txt_separator_t, separator);
+
+ if (fullscreen)
+ {
+ TXT_SetSeparatorLabel(separator, "Screen mode");
+ }
+ else
+ {
+ TXT_SetSeparatorLabel(separator, "Window size");
+ }
+}
-static int win32_video_driver = 0;
+#if defined(_WIN32) && !defined(_WIN32_WCE)
-static char *win32_video_drivers[] =
-{
- "DirectX",
- "Windows GDI",
-};
+static int use_directx = 1;
static void SetWin32VideoDriver(void)
{
if (!strcmp(video_driver, "windib"))
{
- win32_video_driver = 1;
+ use_directx = 0;
}
else
{
- win32_video_driver = 0;
+ use_directx = 1;
}
}
@@ -553,13 +562,15 @@ static void UpdateVideoDriver(TXT_UNCAST_ARG(widget),
TXT_UNCAST_ARG(modes_table))
{
TXT_CAST_ARG(txt_table_t, modes_table);
- char *drivers[] =
- {
- "",
- "windib",
- };
- video_driver = drivers[win32_video_driver != 0];
+ if (use_directx)
+ {
+ video_driver = "";
+ }
+ else
+ {
+ video_driver = "windib";
+ }
// When the video driver is changed, we need to restart the textscreen
// library.
@@ -579,16 +590,72 @@ static void UpdateVideoDriver(TXT_UNCAST_ARG(widget),
#endif
+static void AdvancedDisplayConfig(TXT_UNCAST_ARG(widget),
+ TXT_UNCAST_ARG(modes_table))
+{
+ TXT_CAST_ARG(txt_table_t, modes_table);
+ txt_window_t *window;
+ txt_checkbox_t *ar_checkbox;
+
+ window = TXT_NewWindow("Advanced display options");
+
+ TXT_SetColumnWidths(window, 35);
+
+ TXT_AddWidgets(window,
+ ar_checkbox = TXT_NewCheckBox("Fix aspect ratio",
+ &aspect_ratio_correct),
+ NULL);
+
+ if (gamemission == heretic || gamemission == hexen)
+ {
+ TXT_AddWidget(window,
+ TXT_NewCheckBox("Graphical startup", &graphical_startup));
+ }
+
+ if (gamemission == doom || gamemission == heretic)
+ {
+ TXT_AddWidget(window,
+ TXT_NewCheckBox("Show ENDOOM screen on exit",
+ &show_endoom));
+ }
+
+ TXT_SignalConnect(ar_checkbox, "changed", GenerateModesTable, modes_table);
+
+ // On Windows, there is an extra control to change between
+ // the Windows GDI and DirectX video drivers.
+
+#if defined(_WIN32) && !defined(_WIN32_WCE)
+ {
+ txt_radiobutton_t *dx_button, *gdi_button;
+
+ TXT_AddWidgets(window,
+ TXT_NewSeparator("Windows video driver"),
+ dx_button = TXT_NewRadioButton("DirectX",
+ &use_directx, 1),
+ gdi_button = TXT_NewRadioButton("Windows GDI",
+ &use_directx, 0),
+ NULL);
+
+ TXT_SignalConnect(dx_button, "selected",
+ UpdateVideoDriver, modes_table);
+ TXT_SignalConnect(gdi_button, "selected",
+ UpdateVideoDriver, modes_table);
+ SetWin32VideoDriver();
+ }
+#endif
+}
void ConfigDisplay(void)
{
txt_window_t *window;
txt_table_t *modes_table;
+ txt_separator_t *modes_separator;
txt_table_t *bpp_table;
+ txt_window_action_t *advanced_button;
txt_checkbox_t *fs_checkbox;
- txt_checkbox_t *ar_checkbox;
- txt_dropdown_list_t *bpp_selector;
+ int i;
int num_columns;
+ int num_rows;
int window_y;
// What color depths are supported? Generate supported_bpps array
@@ -606,14 +673,8 @@ void ConfigDisplay(void)
}
// Open the window
-
- window = TXT_NewWindow("Display Configuration");
- TXT_AddWidgets(window,
- fs_checkbox = TXT_NewCheckBox("Fullscreen", &fullscreen),
- ar_checkbox = TXT_NewCheckBox("Correct aspect ratio",
- &aspect_ratio_correct),
- NULL);
+ window = TXT_NewWindow("Display Configuration");
// Some machines can have lots of video modes. This tries to
// keep a limit of six lines by increasing the number of
@@ -621,93 +682,101 @@ void ConfigDisplay(void)
BuildFullscreenModesList();
- window_y = 5;
-
- if (num_screen_modes_fullscreen <= 18)
+ if (num_screen_modes_fullscreen <= 24)
{
num_columns = 3;
}
- else if (num_screen_modes_fullscreen <= 24)
+ else if (num_screen_modes_fullscreen <= 40)
{
num_columns = 4;
}
else
{
num_columns = 5;
- window_y -= 3;
}
modes_table = TXT_NewTable(num_columns);
- // The window is set at a fixed vertical position. This keeps
- // the top of the window stationary when switching between
- // fullscreen and windowed mode (which causes the window's
- // height to change).
+ // Build window:
- TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP,
- TXT_SCREEN_W / 2, window_y);
+ TXT_AddWidget(window,
+ fs_checkbox = TXT_NewCheckBox("Full screen", &fullscreen));
- // On Windows, there is an extra control to change between
- // the Windows GDI and DirectX video drivers.
-
-#if defined(_WIN32) && !defined(_WIN32_WCE)
+ if (num_supported_bpps > 1)
{
- txt_table_t *driver_table;
- txt_dropdown_list_t *driver_list;
-
- driver_table = TXT_NewTable(2);
-
- TXT_SetColumnWidths(driver_table, 20, 0);
-
- TXT_AddWidgets(driver_table,
- TXT_NewLabel("Video driver"),
- driver_list = TXT_NewDropdownList(&win32_video_driver,
- win32_video_drivers,
- 2),
+ TXT_AddWidgets(window,
+ TXT_NewSeparator("Color depth"),
+ bpp_table = TXT_NewTable(4),
NULL);
- TXT_SignalConnect(driver_list, "changed",
- UpdateVideoDriver, modes_table);
- SetWin32VideoDriver();
+ for (i = 0; i < num_supported_bpps; ++i)
+ {
+ txt_radiobutton_t *button;
- TXT_AddWidget(window, driver_table);
- }
-#endif
+ button = TXT_NewRadioButton(supported_bpps[i],
+ &selected_bpp, i);
- // Screen modes list
+ TXT_AddWidget(bpp_table, button);
+ TXT_SignalConnect(button, "selected", UpdateBPP, modes_table);
+ }
+ }
TXT_AddWidgets(window,
- TXT_NewSeparator("Screen mode"),
- bpp_table = TXT_NewTable(2),
+ modes_separator = TXT_NewSeparator(""),
modes_table,
- TXT_NewSeparator("Misc."),
NULL);
- if (gamemission == heretic || gamemission == hexen)
+ TXT_SignalConnect(fs_checkbox, "changed",
+ GenerateModesTable, modes_table);
+ TXT_SignalConnect(fs_checkbox, "changed",
+ UpdateModeSeparator, modes_separator);
+
+ // How many rows high will the configuration window be?
+ // Need to take into account number of fullscreen modes, and also
+ // number of supported pixel depths.
+ // The windowed modes list is four rows, so take the maximum of
+ // windowed and fullscreen.
+
+ num_rows = (num_screen_modes_fullscreen + num_columns - 1) / num_columns;
+
+ if (num_rows < 4)
{
- TXT_AddWidget(window,
- TXT_NewCheckBox("Graphical startup", &graphical_startup));
+ num_rows = 4;
}
- if (gamemission == doom || gamemission == heretic)
+ if (num_supported_bpps > 1)
{
- TXT_AddWidget(window,
- TXT_NewCheckBox("Show ENDOOM screen", &show_endoom));
+ num_rows += 2;
}
- TXT_AddWidgets(bpp_table,
- TXT_NewLabel("Color depth: "),
- bpp_selector = TXT_NewDropdownList(&selected_bpp,
- supported_bpps,
- num_supported_bpps),
- NULL);
+ if (num_rows < 14)
+ {
+ window_y = 8 - ((num_rows + 1) / 2);
+ }
+ else
+ {
+ window_y = 1;
+ }
+ // The window is set at a fixed vertical position. This keeps
+ // the top of the window stationary when switching between
+ // fullscreen and windowed mode (which causes the window's
+ // height to change).
- TXT_SignalConnect(bpp_selector, "changed", UpdateBPP, modes_table);
- TXT_SignalConnect(fs_checkbox, "changed", GenerateModesTable, modes_table);
- TXT_SignalConnect(ar_checkbox, "changed", GenerateModesTable, modes_table);
+ TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP,
+ TXT_SCREEN_W / 2, window_y);
GenerateModesTable(NULL, modes_table);
+ UpdateModeSeparator(NULL, modes_separator);
+
+ // Button to open "advanced" window.
+ // Need to pass a pointer to the modes table, as some of the options
+ // in there trigger a rebuild of it.
+
+ advanced_button = TXT_NewWindowAction('a', "Advanced");
+ TXT_SetWindowAction(window, TXT_HORIZ_CENTER, advanced_button);
+ TXT_SignalConnect(advanced_button, "pressed",
+ AdvancedDisplayConfig, modes_table);
}
void BindDisplayVariables(void)
diff --git a/src/setup/joystick.c b/src/setup/joystick.c
index 0fc00ea1..2a7b1f79 100644
--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -27,6 +27,7 @@
#include "m_controls.h"
#include "textscreen.h"
+#include "execute.h"
#include "joystick.h"
#include "mode.h"
#include "txt_joybinput.h"
@@ -436,6 +437,8 @@ void ConfigJoystick(void)
TXT_SignalConnect(joystick_button, "pressed", CalibrateJoystick, NULL);
TXT_SignalConnect(window, "closed", JoystickWindowClosed, NULL);
+ TXT_SetWindowAction(window, TXT_HORIZ_CENTER, TestConfigAction());
+
SetJoystickButtonLabel();
}
diff --git a/src/setup/setup-manifest.xml.in b/src/setup/setup-manifest.xml.in
index bac9a05e..ff879263 100644
--- a/src/setup/setup-manifest.xml.in
+++ b/src/setup/setup-manifest.xml.in
@@ -1,16 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!-- Magic manifest file that should make Windows Vista/7 not
+ attempt to gain elevated privileges for chocolate-setup.
+
+ Based on:
+
+ http://www.cygwin.com/ml/cygwin/2006-12/msg00580.html
+ -->
+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<!-- The "name" field in this tag should be the same as the executable's
name -->
- <assemblyIdentity version="@PACKAGE_VERSION@.0" processorArchitecture="*"
- name="@PROGRAM_PREFIX@setup" type="win32"/>
+ <assemblyIdentity version="0.0.0.0" processorArchitecture="X86"
+ name="@PROGRAM_PREFIX@setup.exe" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
- <!-- Hi Vista! We don't require elevated privileges. Thanks! -->
- <requestedExecutionLevel level="asInvoker"/>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
+
+ <!-- Stop the Program Compatibility Assistant appearing: -->
+
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> <!-- 7 -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> <!-- Vista -->
+ </application>
+ </compatibility>
</assembly>
diff --git a/src/setup/setup.desktop.in b/src/setup/setup.desktop.in
new file mode 100644
index 00000000..79fb38be
--- /dev/null
+++ b/src/setup/setup.desktop.in
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=@PACKAGE_NAME@ Setup
+Exec=@PROGRAM_PREFIX@setup
+Icon=@PROGRAM_PREFIX@setup
+Type=Application
+Comment=Setup tool for @PACKAGE_NAME@
+Categories=Settings;ConsoleOnly;
diff --git a/src/setup/sound.c b/src/setup/sound.c
index 627549b5..9e13edd9 100644
--- a/src/setup/sound.c
+++ b/src/setup/sound.c
@@ -68,7 +68,7 @@ static char *musicmode_strings[] =
int snd_sfxdevice = SNDDEVICE_SB;
int snd_musicdevice = SNDDEVICE_GENMIDI;
-int snd_samplerate = 22050;
+int snd_samplerate = 44100;
int opl_io_port = 0x388;
static int numChannels = 8;
diff --git a/src/setup/txt_joybinput.c b/src/setup/txt_joybinput.c
index cde3d2c2..9ad26a45 100644
--- a/src/setup/txt_joybinput.c
+++ b/src/setup/txt_joybinput.c
@@ -48,7 +48,12 @@ static int EventCallback(SDL_Event *event, TXT_UNCAST_ARG(joystick_input))
if (event->type == SDL_JOYBUTTONDOWN)
{
*joystick_input->variable = event->jbutton.button;
- TXT_EmitSignal(joystick_input, "set");
+
+ if (joystick_input->check_conflicts)
+ {
+ TXT_EmitSignal(joystick_input, "set");
+ }
+
TXT_CloseWindow(joystick_input->prompt_window);
return 1;
}
@@ -89,6 +94,10 @@ static void OpenPromptWindow(txt_joystick_input_t *joystick_input)
txt_label_t *label;
SDL_Joystick *joystick;
+ // Silently update when the shift button is held down.
+
+ joystick_input->check_conflicts = !TXT_GetModifierState(TXT_MOD_SHIFT);
+
if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
{
return;
@@ -153,15 +162,7 @@ static void TXT_JoystickInputDrawer(TXT_UNCAST_ARG(joystick_input), int selected
GetJoystickButtonDescription(*joystick_input->variable, buf);
}
- if (selected)
- {
- TXT_BGColor(TXT_COLOR_GREY, 0);
- }
- else
- {
- TXT_BGColor(TXT_COLOR_BLUE, 0);
- }
-
+ TXT_SetWidgetBG(joystick_input, selected);
TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
TXT_DrawString(buf);
diff --git a/src/setup/txt_joybinput.h b/src/setup/txt_joybinput.h
index b2920b88..69ec4a1f 100644
--- a/src/setup/txt_joybinput.h
+++ b/src/setup/txt_joybinput.h
@@ -37,6 +37,7 @@ struct txt_joystick_input_s
txt_widget_t widget;
int *variable;
txt_window_t *prompt_window;
+ int check_conflicts;
};
txt_joystick_input_t *TXT_NewJoystickInput(int *variable);
diff --git a/src/setup/txt_keyinput.c b/src/setup/txt_keyinput.c
index 08eb9d8c..6f1ee4dd 100644
--- a/src/setup/txt_keyinput.c
+++ b/src/setup/txt_keyinput.c
@@ -42,7 +42,12 @@ static int KeyPressCallback(txt_window_t *window, int key,
// Got the key press. Save to the variable and close the window.
*key_input->variable = key;
- TXT_EmitSignal(key_input, "set");
+
+ if (key_input->check_conflicts)
+ {
+ TXT_EmitSignal(key_input, "set");
+ }
+
TXT_CloseWindow(window);
// Re-enable key mappings now that we have the key
@@ -67,6 +72,10 @@ static void OpenPromptWindow(txt_key_input_t *key_input)
txt_window_t *window;
txt_label_t *label;
+ // Silently update when the shift button is held down.
+
+ key_input->check_conflicts = !TXT_GetModifierState(TXT_MOD_SHIFT);
+
window = TXT_NewWindow(NULL);
TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
@@ -118,15 +127,7 @@ static void TXT_KeyInputDrawer(TXT_UNCAST_ARG(key_input), int selected)
TXT_GetKeyDescription(*key_input->variable, buf);
}
- if (selected)
- {
- TXT_BGColor(TXT_COLOR_GREY, 0);
- }
- else
- {
- TXT_BGColor(TXT_COLOR_BLUE, 0);
- }
-
+ TXT_SetWidgetBG(key_input, selected);
TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
TXT_DrawString(buf);
diff --git a/src/setup/txt_keyinput.h b/src/setup/txt_keyinput.h
index 4952a970..5df0b2e3 100644
--- a/src/setup/txt_keyinput.h
+++ b/src/setup/txt_keyinput.h
@@ -35,6 +35,7 @@ struct txt_key_input_s
{
txt_widget_t widget;
int *variable;
+ int check_conflicts;
};
txt_key_input_t *TXT_NewKeyInput(int *variable);
diff --git a/src/setup/txt_mouseinput.c b/src/setup/txt_mouseinput.c
index 4f454c8c..c3e17299 100644
--- a/src/setup/txt_mouseinput.c
+++ b/src/setup/txt_mouseinput.c
@@ -42,7 +42,12 @@ static int MousePressCallback(txt_window_t *window,
// Got the mouse press. Save to the variable and close the window.
*mouse_input->variable = b - TXT_MOUSE_BASE;
- TXT_EmitSignal(mouse_input, "set");
+
+ if (mouse_input->check_conflicts)
+ {
+ TXT_EmitSignal(mouse_input, "set");
+ }
+
TXT_CloseWindow(window);
return 1;
@@ -53,6 +58,9 @@ static void OpenPromptWindow(txt_mouse_input_t *mouse_input)
txt_window_t *window;
txt_label_t *label;
+ // Silently update when the shift key is held down.
+ mouse_input->check_conflicts = !TXT_GetModifierState(TXT_MOD_SHIFT);
+
window = TXT_NewWindow(NULL);
TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
@@ -111,15 +119,7 @@ static void TXT_MouseInputDrawer(TXT_UNCAST_ARG(mouse_input), int selected)
GetMouseButtonDescription(*mouse_input->variable, buf);
}
- if (selected)
- {
- TXT_BGColor(TXT_COLOR_GREY, 0);
- }
- else
- {
- TXT_BGColor(TXT_COLOR_BLUE, 0);
- }
-
+ TXT_SetWidgetBG(mouse_input, selected);
TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);
TXT_DrawString(buf);
diff --git a/src/setup/txt_mouseinput.h b/src/setup/txt_mouseinput.h
index 57c258eb..ef3ec2aa 100644
--- a/src/setup/txt_mouseinput.h
+++ b/src/setup/txt_mouseinput.h
@@ -35,6 +35,7 @@ struct txt_mouse_input_s
{
txt_widget_t widget;
int *variable;
+ int check_conflicts;
};
txt_mouse_input_t *TXT_NewMouseInput(int *variable);