Change Windows startup
remove the safeproc pseudo-windowport routines from
almost a decade ago.
A very early pass is made through the config file,
seeking out just the interface-related OPTIONS=windowport
and OPTIONS=soundlib and ignoring all other options in the
config file during that early pass, so the windowport
can be activated without the NetHack core initialization
in place that some of the other rcfile OPTIONS require.
Bundles the existing rcfile processing code into rcfile().
New functions to control which rcfile options will be
disregarded in the early config file pass, and which will be
processed:
set_all_options_disregarded();
set_all_options_heeded();
disregard_this_option(opt_xx);
heed_this_option(opt_xx);
Windows calls rcfile_interface_options(), which is
a bundling of a series of function calls to achieve
the desired result.
void
rcfile_interface_options(void)
{
allopt_array_init();
set_all_options_disregarded();
heed_this_option(opt_windowtype);
heed_this_option(opt_soundlib);
rcfile();
set_all_options_heeded();
disregard_this_option(opt_windowtype);
disregard_this_option(opt_soundlib);
}
This commit is contained in:
@@ -725,7 +725,8 @@ struct instance_globals_o {
|
||||
|
||||
/* options.c */
|
||||
|
||||
int opt_phase; /* builtin_opt, syscf_, rc_file_, environ_, play_opt */
|
||||
/* builtin_opt, syscf_, rc_file_, environ_, play_opt */
|
||||
enum option_phases opt_phase;
|
||||
boolean opt_initial;
|
||||
boolean opt_from_file;
|
||||
boolean opt_need_redraw; /* for doset() */
|
||||
|
||||
@@ -335,6 +335,8 @@ extern boolean parse_conf_file(FILE *fp, boolean (*proc)(char *arg));
|
||||
extern void set_configfile_name(const char *);
|
||||
extern char *get_configfile(void);
|
||||
extern const char *get_default_configfile(void);
|
||||
extern void rcfile(void);
|
||||
extern void rcfile_interface_options(void);
|
||||
|
||||
/* ### coloratt.c ### */
|
||||
|
||||
@@ -2320,6 +2322,10 @@ extern int msgtype_type(const char *, boolean) NONNULLARG1;
|
||||
extern void hide_unhide_msgtypes(boolean, int);
|
||||
extern void msgtype_free(void);
|
||||
extern void options_free_window_colors(void);
|
||||
extern void set_all_options_heeded(void);
|
||||
extern void set_all_options_disregarded(void);
|
||||
extern void heed_this_option(enum opt);
|
||||
extern void disregard_this_option(enum opt);
|
||||
#ifdef TTY_PERM_INVENT
|
||||
extern void check_perm_invent_again(void);
|
||||
#endif
|
||||
@@ -2345,6 +2351,7 @@ extern int dowhatdoes(void);
|
||||
extern char *dowhatdoes_core(char, char *) NONNULLARG2; /*might return NULL*/
|
||||
extern int dohelp(void);
|
||||
extern int dohistory(void);
|
||||
void allopt_array_init(void);
|
||||
|
||||
/* ### xxmain.c ### */
|
||||
|
||||
|
||||
@@ -102,8 +102,6 @@ typedef unsigned readLenType;
|
||||
#endif
|
||||
#define BOOL_RANDOM (-1)
|
||||
|
||||
enum optchoice { opt_in, opt_out};
|
||||
|
||||
/*
|
||||
* type nhsym: loadable symbols go into this type
|
||||
*/
|
||||
@@ -153,6 +151,16 @@ typedef uchar nhsym;
|
||||
#endif /* __GNUC__ || _MSC_VER */
|
||||
#endif /* !__clang__ */
|
||||
|
||||
#define SET__IS_VALUE_VALID(s) ((s < set_in_sysconf) || (s > set_wiznofuz))
|
||||
#include "optlist.h"
|
||||
enum opt {
|
||||
opt_prefix_only = -1,
|
||||
#define NHOPT_ENUM
|
||||
#include "optlist.h"
|
||||
#undef NHOPT_ENUM
|
||||
OPTCOUNT
|
||||
};
|
||||
|
||||
/*
|
||||
* Automatic inclusions for the subsidiary files.
|
||||
* Please don't change the order. It does matter.
|
||||
|
||||
@@ -702,22 +702,6 @@ enum nhcb_calls {
|
||||
NUM_NHCB
|
||||
};
|
||||
|
||||
/*
|
||||
* option setting restrictions
|
||||
*/
|
||||
|
||||
enum optset_restrictions {
|
||||
set_in_sysconf = 0, /* system config file option only */
|
||||
set_in_config = 1, /* config file option only */
|
||||
set_viaprog = 2, /* may be set via extern program, not seen in game */
|
||||
set_gameview = 3, /* may be set via extern program, displayed in game */
|
||||
set_in_game = 4, /* may be set via extern program or set in the game */
|
||||
set_wizonly = 5, /* may be set in the game if wizmode */
|
||||
set_wiznofuz = 6, /* wizard-mode only, but not by fuzzer */
|
||||
set_hidden = 7 /* placeholder for prefixed entries, never show it */
|
||||
};
|
||||
#define SET__IS_VALUE_VALID(s) ((s < set_in_sysconf) || (s > set_wiznofuz))
|
||||
|
||||
struct plinemsg_type {
|
||||
xint16 msgtype; /* one of MSGTYP_foo */
|
||||
struct nhregex *regex;
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
#ifndef OPTLIST_H
|
||||
#define OPTLIST_H
|
||||
|
||||
#ifdef OPTIONS_C
|
||||
static int optfn_boolean(int, int, boolean, char *, char *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NOTE: If you add (or delete) an option, please review:
|
||||
* doc/options.txt
|
||||
@@ -16,6 +12,37 @@ static int optfn_boolean(int, int, boolean, char *, char *);
|
||||
* updates that should accompany your change.
|
||||
*/
|
||||
|
||||
#define BACKWARD_COMPAT
|
||||
|
||||
extern int optfn_boolean(int, int, boolean, char *, char *);
|
||||
enum optchoice { opt_in, opt_out };
|
||||
|
||||
/*
|
||||
* option setting restrictions
|
||||
*/
|
||||
enum optset_restrictions {
|
||||
set_in_sysconf = 0, /* system config file option only */
|
||||
set_in_config = 1, /* config file option only */
|
||||
set_viaprog = 2, /* may be set via extern program, not seen in game */
|
||||
set_gameview = 3, /* may be set via extern program, displayed in game */
|
||||
set_in_game = 4, /* may be set via extern program or set in the game */
|
||||
set_wizonly = 5, /* may be set in the game if wizmode */
|
||||
set_wiznofuz = 6, /* wizard-mode only, but not by fuzzer */
|
||||
set_hidden = 7 /* placeholder for prefixed entries, never show it */
|
||||
};
|
||||
|
||||
/* these aren't the same as set_xxx */
|
||||
enum option_phases {
|
||||
phase_not_set = 0,
|
||||
builtin_opt = 1, /* compiled-in default value of an option */
|
||||
syscf_opt, /* sysconf setting of an option, overrides builtin */
|
||||
rc_file_opt, /* player's run-time config file setting, overrides syscf */
|
||||
environ_opt, /* player's environment NETHACKOPTIONS, overrides rc_file */
|
||||
cmdline_opt, /* program invocation command-line, overrides environ */
|
||||
play_opt, /* 'O' command, interactively set so overrides all */
|
||||
num_opt_phases
|
||||
};
|
||||
|
||||
enum OptType { BoolOpt, CompOpt, OthrOpt };
|
||||
enum Y_N { No, Yes };
|
||||
enum Off_On { Off, On };
|
||||
@@ -45,7 +72,7 @@ struct allopt_t {
|
||||
const char *alias;
|
||||
const char *descr;
|
||||
const char *prefixgw;
|
||||
boolean initval, has_handler, dupdetected;
|
||||
boolean initval, has_handler, dupdetected, disregarded;
|
||||
};
|
||||
|
||||
#endif /* OPTLIST_H */
|
||||
@@ -74,16 +101,16 @@ static int optfn_##a(int, int, boolean, char *, char *);
|
||||
#elif defined(NHOPT_PARSE)
|
||||
#define NHOPTB(a, sec, b, c, s, i, n, v, d, al, bp, termp, desc) \
|
||||
{ #a, OptS_##sec, 0, b, opt_##a, s, BoolOpt, n, v, d, No, termp, c, \
|
||||
bp, &optfn_boolean, al, desc, (const char *) 0, i, 0, 0 },
|
||||
bp, &optfn_boolean, al, desc, (const char *) 0, i, 0, 0 , 0 },
|
||||
#define NHOPTC(a, sec, b, c, s, n, v, d, h, al, z) \
|
||||
{ #a, OptS_##sec, 0, b, opt_##a, s, CompOpt, n, v, d, No, 0, c, \
|
||||
(boolean *) 0, &optfn_##a, al, z, (const char *) 0, Off, h, 0 },
|
||||
(boolean *) 0, &optfn_##a, al, z, (const char *) 0, Off, h, 0, 0 },
|
||||
#define NHOPTP(a, sec, b, c, s, n, v, d, h, al, z) \
|
||||
{ #a, OptS_##sec, 0, b, pfx_##a, s, CompOpt, n, v, d, Yes, 0, c, \
|
||||
(boolean *) 0, &pfxfn_##a, al, z, #a, Off, h, 0 },
|
||||
(boolean *) 0, &pfxfn_##a, al, z, #a, Off, h, 0, 0 },
|
||||
#define NHOPTO(m, sec, a, b, c, s, n, v, d, al, z) \
|
||||
{ m, OptS_##sec, 0, b, opt_##a, s, OthrOpt, n, v, d, No, 0, c, \
|
||||
(boolean *) 0, &optfn_##a, al, z, (const char *) 0, On, On, 0 },
|
||||
(boolean *) 0, &optfn_##a, al, z, (const char *) 0, On, On, 0, 0 },
|
||||
|
||||
/* this is not reliable because TILES_IN_GLYPHMAP might be defined
|
||||
* in a multi-interface binary but not apply to the current interface */
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#define OPTIONS_AT_RUNTIME /* build info done at runtime not text file */
|
||||
|
||||
#define EARLY_CONFIGFILE_PASS
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------
|
||||
* The remaining code shouldn't need modification.
|
||||
|
||||
@@ -415,79 +415,4 @@ struct chain_procs {
|
||||
};
|
||||
#endif /* WINCHAIN */
|
||||
|
||||
#ifdef SAFEPROCS
|
||||
/*
|
||||
* window port routines available in sys/share/safeproc.c
|
||||
*/
|
||||
extern struct window_procs *get_safe_procs(int);
|
||||
extern void safe_init_nhwindows(int *, char **);
|
||||
extern void safe_player_selection(void);
|
||||
extern void safe_askname(void);
|
||||
extern void safe_get_nh_event(void);
|
||||
extern void safe_exit_nhwindows(const char *);
|
||||
extern void safe_suspend_nhwindows(const char *);
|
||||
extern void safe_resume_nhwindows(void);
|
||||
extern winid safe_create_nhwindow(int);
|
||||
extern void safe_clear_nhwindow(winid);
|
||||
extern void safe_display_nhwindow(winid, boolean);
|
||||
extern void safe_destroy_nhwindow(winid);
|
||||
extern void safe_curs(winid, int, int);
|
||||
extern void safe_putstr(winid, int, const char *);
|
||||
extern void safe_putmixed(winid, int, const char *);
|
||||
extern void safe_display_file(const char *, boolean);
|
||||
extern void safe_start_menu(winid, unsigned long);
|
||||
extern void safe_add_menu(winid, const glyph_info *, const ANY_P *,
|
||||
char, char, int, int, const char *,
|
||||
unsigned int);
|
||||
extern void safe_end_menu(winid, const char *);
|
||||
extern int safe_select_menu(winid, int, MENU_ITEM_P **);
|
||||
extern char safe_message_menu(char, int, const char *);
|
||||
extern void safe_mark_synch(void);
|
||||
extern void safe_wait_synch(void);
|
||||
#ifdef CLIPPING
|
||||
extern void safe_cliparound(int, int);
|
||||
#endif
|
||||
#ifdef POSITIONBAR
|
||||
extern void safe_update_positionbar(char *);
|
||||
#endif
|
||||
extern void safe_print_glyph(winid, coordxy, coordxy,
|
||||
const glyph_info *, const glyph_info *);
|
||||
extern void safe_raw_print(const char *);
|
||||
extern void safe_raw_print_bold(const char *);
|
||||
extern int safe_nhgetch(void);
|
||||
extern int safe_nh_poskey(coordxy *, coordxy *, int *);
|
||||
extern void safe_nhbell(void);
|
||||
extern int safe_doprev_message(void);
|
||||
extern char safe_yn_function(const char *, const char *, char);
|
||||
extern void safe_getlin(const char *, char *);
|
||||
extern int safe_get_ext_cmd(void);
|
||||
extern void safe_number_pad(int);
|
||||
extern void safe_delay_output(void);
|
||||
#ifdef CHANGE_COLOR
|
||||
extern void safe_change_color(int, long, int);
|
||||
#ifdef MAC
|
||||
extern void safe_change_background(int);
|
||||
extern short safe_set_font_name(winid, char *);
|
||||
#endif
|
||||
extern char *safe_get_color_string(void);
|
||||
#endif
|
||||
extern void safe_outrip(winid, int, time_t);
|
||||
extern void safe_preference_update(const char *);
|
||||
extern char *safe_getmsghistory(boolean);
|
||||
extern void safe_putmsghistory(const char *, boolean);
|
||||
extern void safe_status_init(void);
|
||||
extern void safe_status_finish(void);
|
||||
extern void safe_status_enablefield(int, const char *, const char *,
|
||||
boolean);
|
||||
extern void safe_status_update(int, genericptr_t, int, int, int,
|
||||
unsigned long *);
|
||||
extern boolean safe_can_suspend(void);
|
||||
extern void stdio_raw_print(const char *);
|
||||
extern void stdio_nonl_raw_print(const char *);
|
||||
extern void stdio_raw_print_bold(const char *);
|
||||
extern void stdio_wait_synch(void);
|
||||
extern void safe_update_inventory(int);
|
||||
extern win_request_info *safe_ctrl_nhwindow(winid, int, win_request_info *);
|
||||
extern int stdio_nhgetch(void);
|
||||
#endif /* SAFEPROCS */
|
||||
#endif /* WINPROCS_H */
|
||||
|
||||
Reference in New Issue
Block a user