update the code for portable Windows configuration

Restrict which options in sysconf will be processed
when seeking PORTABLE_DEVICE_PATHS.
This commit is contained in:
nhmall
2026-05-10 21:11:17 -04:00
parent 2337a2bae5
commit 610bd839ee
4 changed files with 110 additions and 68 deletions
+18 -12
View File
@@ -59,6 +59,7 @@ void windows_nhbell(void);
int windows_nh_poskey(int *, int *, int *);
void windows_raw_print(const char *);
char windows_yn_function(const char *, const char *, char);
boolean portable = FALSE;
/* static void windows_getlin(const char *, char *); */
#ifdef WIN32CON
@@ -206,8 +207,11 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
}
gh.hname = "NetHack"; /* used for syntax messages */
set_default_prefix_locations(
argv[0]); /* must be re-done after initoptions_init()
* which clears out gp.fqn_prefix[] */
argv[0]); /* must be re-done again after initoptions_init()
* because that function clears out gp.fqn_prefix[] */
#ifdef MSWIN_GRAPHICS
disregard_some_mswin_options();
#endif
copy_sysconf_content();
copy_symbols_content();
/* Now that sysconf has had a chance to set the TROUBLEPREFIX, don't
@@ -260,9 +264,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
early_options(&argc, &argv, &dir);
program_state.early_options = 0;
#ifdef MSWIN_GRAPHICS
disregard_some_mswin_options();
#endif
initoptions();
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdir(gf.fqn_prefix[HACKPREFIX]);
@@ -802,15 +804,19 @@ copy_symbols_content(void)
void
copy_sysconf_content(void)
{
/* Using the SYSCONFPREFIX path, lock it so that it does not change */
fqn_prefix_locked[SYSCONFPREFIX] = TRUE;
if (sysopt.portable_device_paths) {
portable = TRUE;
} else {
/* Using the SYSCONFPREFIX path, lock it so that it does not change */
fqn_prefix_locked[SYSCONFPREFIX] = TRUE;
update_file(gf.fqn_prefix[SYSCONFPREFIX], SYSCF_TEMPLATE,
gf.fqn_prefix[DATAPREFIX], SYSCF_TEMPLATE, FALSE);
update_file(gf.fqn_prefix[SYSCONFPREFIX], SYSCF_TEMPLATE,
gf.fqn_prefix[DATAPREFIX], SYSCF_TEMPLATE, FALSE);
/* If the required early game file does not exist, copy it */
copy_file(gf.fqn_prefix[SYSCONFPREFIX], SYSCF_FILE,
gf.fqn_prefix[DATAPREFIX], SYSCF_TEMPLATE, FALSE);
/* If the required early game file does not exist, copy it */
copy_file(gf.fqn_prefix[SYSCONFPREFIX], SYSCF_FILE,
gf.fqn_prefix[DATAPREFIX], SYSCF_TEMPLATE, FALSE);
}
}
void