From 24f2e098c5107b97d9f6cbe0174627cfcf31b003 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 25 Jan 2020 12:34:06 -0500 Subject: [PATCH 1/3] Xcode build fixes --- src/region.c | 4 ++-- sys/unix/NetHack.xcodeproj/project.pbxproj | 22 ++++++++++++++++++- .../xcshareddata/xcschemes/NetHack.xcscheme | 10 +++------ .../xcshareddata/xcschemes/makedefs.xcscheme | 10 +++------ .../xcshareddata/xcschemes/recover.xcscheme | 10 +++------ 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/region.c b/src/region.c index fae8883ff..f0b775d67 100644 --- a/src/region.c +++ b/src/region.c @@ -430,7 +430,7 @@ boolean in_out_region(x, y) xchar x, y; { - int i, f_indx; + int i, f_indx = 0; /* First check if hero can do the move */ for (i = 0; i < n_regions; i++) { @@ -485,7 +485,7 @@ m_in_out_region(mon, x, y) struct monst *mon; xchar x, y; { - int i, f_indx; + int i, f_indx = 0; /* First check if mon can do the move */ for (i = 0; i < n_regions; i++) { diff --git a/sys/unix/NetHack.xcodeproj/project.pbxproj b/sys/unix/NetHack.xcodeproj/project.pbxproj index 94d7eacc0..fdee88475 100644 --- a/sys/unix/NetHack.xcodeproj/project.pbxproj +++ b/sys/unix/NetHack.xcodeproj/project.pbxproj @@ -166,6 +166,8 @@ isa = PBXBuildRule; compilerSpec = com.apple.compilers.proxy.script; fileType = sourcecode.yacc; + inputFiles = ( + ); isEditable = 1; outputFiles = ( "$(NH_INC_DIR)/lev_comp.h", @@ -177,6 +179,8 @@ isa = PBXBuildRule; compilerSpec = com.apple.compilers.proxy.script; fileType = sourcecode.lex; + inputFiles = ( + ); isEditable = 1; outputFiles = ( "$(NH_UTIL_DIR)/lev_lex.c", @@ -188,6 +192,8 @@ compilerSpec = com.apple.compilers.proxy.script; filePatterns = dgn_comp.y; fileType = sourcecode.yacc; + inputFiles = ( + ); isEditable = 1; outputFiles = ( "$(NH_UTIL_DIR)/dgn_yacc.c", @@ -199,6 +205,8 @@ isa = PBXBuildRule; compilerSpec = com.apple.compilers.proxy.script; fileType = sourcecode.lex; + inputFiles = ( + ); isEditable = 1; outputFiles = ( "$(NH_UTIL_DIR)/dgn_lex.c", @@ -1129,7 +1137,7 @@ 3189576921A1FCC100FB2ABE /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1010; + LastUpgradeCheck = 1130; ORGANIZATIONNAME = "Bart House"; TargetAttributes = { 3189577021A1FCC100FB2ABE = { @@ -2111,6 +2119,7 @@ 3189577921A1FCC100FB2ABE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = c99; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2120,6 +2129,7 @@ 3189577A21A1FCC100FB2ABE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = c99; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2129,6 +2139,7 @@ 3189578421A1FDA400FB2ABE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2137,6 +2148,7 @@ 3189578521A1FDA400FB2ABE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2145,6 +2157,7 @@ 31B8A42321A2669A0055BD01 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2153,6 +2166,7 @@ 31B8A42421A2669A0055BD01 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2163,6 +2177,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = gnu11; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2174,6 +2189,7 @@ buildSettings = { CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; GCC_C_LANGUAGE_STANDARD = gnu11; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2183,6 +2199,7 @@ 31B8A44F21A26A4B0055BD01 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2191,6 +2208,7 @@ 31B8A45021A26A4B0055BD01 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2199,6 +2217,7 @@ 31B8A45C21A26A970055BD01 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; @@ -2207,6 +2226,7 @@ 31B8A45D21A26A970055BD01 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; PRODUCT_NAME = "$(TARGET_NAME)"; }; diff --git a/sys/unix/NetHack.xcodeproj/xcshareddata/xcschemes/NetHack.xcscheme b/sys/unix/NetHack.xcodeproj/xcshareddata/xcschemes/NetHack.xcscheme index 92558e275..7abc16af5 100644 --- a/sys/unix/NetHack.xcodeproj/xcshareddata/xcschemes/NetHack.xcscheme +++ b/sys/unix/NetHack.xcodeproj/xcshareddata/xcschemes/NetHack.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - - - - - + + - - - - - - + + - - Date: Sat, 25 Jan 2020 12:08:28 -0800 Subject: [PATCH 2/3] unix 'make clean' update Remove dat/gitinfo.txt which has been getting overlooked. Hardly urgent, but useful if this is the last 3.5.x release. --- sys/unix/Makefile.dat | 6 +++++- sys/unix/Makefile.top | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/unix/Makefile.dat b/sys/unix/Makefile.dat index 466a14f63..00f604396 100644 --- a/sys/unix/Makefile.dat +++ b/sys/unix/Makefile.dat @@ -165,7 +165,11 @@ dungeon: dungeon.def ../util/makedefs ../util/dgn_comp ../util/makedefs -e ../util/dgn_comp dungeon.pdf -spotless: +# gitinfo.txt is optionally made by src/Makefile when creating date.h +clean: + -rm -f gitinfo.txt + +spotless: clean -rm -f spec_levs quest_levs *.lev $(VARDAT) dungeon dungeon.pdf -rm -f nhdat x11tiles beostiles pet_mark.xbm pilemark.xbm rip.xpm mapbg.xpm -rm -f rip.img GEM_RSC.RSC title.img nh16.img NetHack.ad diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index 5aea4e8d6..ad7607cd9 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -287,6 +287,7 @@ install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs clean: ( cd src ; $(MAKE) clean ) ( cd util ; $(MAKE) clean ) + ( cd dat ; $(MAKE) clean ) ( cd doc ; $(MAKE) clean ) # 'make spotless' returns the source tree to near-distribution condition. From 05455f7baafb5dcb06d3018d5a169c4f8d848dde Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 25 Jan 2020 17:07:45 -0800 Subject: [PATCH 3/3] Fall back to executable path if we have trouble converting known path. --- doc/fixes36.5 | 2 +- sys/winnt/windmain.c | 46 ++++++++++++++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/doc/fixes36.5 b/doc/fixes36.5 index 514e59c01..0422a69ff 100644 --- a/doc/fixes36.5 +++ b/doc/fixes36.5 @@ -25,7 +25,7 @@ Fixes to Post-3.6.4 Problems that Were Exposed Via git Repository Platform- and/or Interface-Specific Fixes or Features ----------------------------------------------------- Windows OPTIONS=map_mode:fit_to_screen could cause a game start failure - +Windows users with C-locale unmappable names could get game start failure General New Features -------------------- diff --git a/sys/winnt/windmain.c b/sys/winnt/windmain.c index 4ca0c6bfc..2a4b4f581 100644 --- a/sys/winnt/windmain.c +++ b/sys/winnt/windmain.c @@ -79,24 +79,34 @@ static struct stat hbuf; extern char orgdir[]; -void +int get_known_folder_path( const KNOWNFOLDERID * folder_id, char * path , size_t path_size) { PWSTR wide_path; - if (FAILED(SHGetKnownFolderPath(folder_id, 0, NULL, &wide_path))) + if (FAILED(SHGetKnownFolderPath(folder_id, 0, NULL, &wide_path))) { error("Unable to get known folder path"); + return FALSE; + } size_t converted; errno_t err; - err = wcstombs_s(&converted, path, path_size, wide_path, path_size - 1); + err = wcstombs_s(&converted, path, path_size, wide_path, _TRUNCATE); CoTaskMemFree(wide_path); - if (err != 0) error("Failed folder path string conversion"); + if (err == STRUNCATE || err == EILSEQ) { + // silently handle this problem + return FALSE; + } else if (err != 0) { + error("Failed folder (%u) path string conversion, unexpected err = %d", folder_id->Data1, err); + return FALSE; + } + + return TRUE; } void @@ -108,14 +118,16 @@ create_directory(const char * path) error("Unable to create directory '%s'", path); } -void +int build_known_folder_path( const KNOWNFOLDERID * folder_id, char * path, size_t path_size, boolean versioned) { - get_known_folder_path(folder_id, path, path_size); + if(!get_known_folder_path(folder_id, path, path_size)) + return FALSE; + strcat(path, "\\NetHack\\"); create_directory(path); if (versioned) { @@ -123,6 +135,7 @@ build_known_folder_path( VERSION_MAJOR, VERSION_MINOR); create_directory(path); } + return TRUE; } void @@ -250,17 +263,22 @@ set_default_prefix_locations(const char *programPath) fqn_prefix[TROUBLEPREFIX] = portable_device_path; fqn_prefix[DATAPREFIX] = executable_path; } else { - build_known_folder_path(&FOLDERID_Profile, profile_path, - sizeof(profile_path), FALSE); + if(!build_known_folder_path(&FOLDERID_Profile, profile_path, + sizeof(profile_path), FALSE)) + strcpy(profile_path, executable_path); - build_known_folder_path(&FOLDERID_Profile, versioned_profile_path, - sizeof(profile_path), TRUE); + if(!build_known_folder_path(&FOLDERID_Profile, versioned_profile_path, + sizeof(profile_path), TRUE)) + strcpy(versioned_profile_path, executable_path); - build_known_folder_path(&FOLDERID_LocalAppData, - versioned_user_data_path, sizeof(versioned_user_data_path), TRUE); + if(!build_known_folder_path(&FOLDERID_LocalAppData, + versioned_user_data_path, sizeof(versioned_user_data_path), TRUE)) + strcpy(versioned_user_data_path, executable_path); + + if(!build_known_folder_path(&FOLDERID_ProgramData, + versioned_global_data_path, sizeof(versioned_global_data_path), TRUE)) + strcpy(versioned_global_data_path, executable_path); - build_known_folder_path(&FOLDERID_ProgramData, - versioned_global_data_path, sizeof(versioned_global_data_path), TRUE); fqn_prefix[SYSCONFPREFIX] = versioned_global_data_path; fqn_prefix[CONFIGPREFIX] = profile_path; fqn_prefix[HACKPREFIX] = versioned_profile_path;