Commit Graph

2763 Commits

Author SHA1 Message Date
nhmall
5560bdb27c msdos recover 2025-04-15 19:53:50 -04:00
nhmall
46d4639d66 visual studio build fix (for recover) 2025-04-15 18:56:34 -04:00
nhmall
44af2a96a5 recover utility updates 2025-04-15 18:02:44 -04:00
nhmall
a3e12550ea savefile changes - part 1
This is the first of several savefile-related changes to
follow later. This one is groundwork for those later changes.

Remove internal compression schemes (RLECOMP and ZEROCOMP)
and discard the savefile_info struct that was primarily used to
convey which internal compression schemes had been in use.

Relocate some struct definitions into appropriate header files
for use by code to come in later changes.

Remove the two struct size-related fields from version_info and
from the nmakedefs_s. Instead, include a series of bytes near the
beginning of the savefile, representing the size of each
struct or base data type that impacts the historical savefile
content. Those are referred to as the "critical bytes".
(Related note: the "you" struct required two bytes, low and high,
due to its size).

Compare those critical bytes in a savefile against the NetHack
build that is reading the savefile. This allows mismatch detection
early in the savefile-reading process, and a clean exit, rather than
proceeding to read nonsensical values from the file. Include some
feedback on what the first mismatch was when encountering
one.

For arrays stored in the savefile, use loop-logic in the core
to write/read the array elements one at a time, rather than in
a single blob. This will be required for changes to follow later.
(impacts artiexist[], artidisco[], svd.dungeons[], svl.level_info[],
svl.level.locations[][], msrooms[] field of mapseen, svb.bases[],
svb.disco[] objects[], svm.mvitals[], svs.spl_book[], svd.doors[],
go.oracle_loc[], utrack[], wgrowtime[])

This also adds data model to the long version information.

This invalidates existing save and bones files due to the changes in
the information at the start of the file.
2025-04-15 15:35:17 -04:00
nhmall
eeb96c4151 update tested versions of Visual Studio 2025-04-13 2025-04-13 10:22:59 -04:00
nhmall
3ed63f9be4 more Xcode cleanup 2025-03-19 21:20:39 -04:00
nhmall
f30780e42e clean up absolute paths 2025-03-19 21:16:46 -04:00
nhmall
872a9778ed Xcode project update 2025-03-19 19:26:27 -04:00
nhmall
e70b92e200 paste error in Makefile.nmake 2025-03-19 17:31:19 -04:00
nhmall
1f99638bbf ren nhconst.h -> weight.h
The speed related values were not used, except for NORMAL_SPEED,
which has been moved back to permonst.h
2025-03-19 17:14:07 -04:00
nhmall
a943c4c10b replace some weight-related magic numbers
adds a header file include/nhconst.h  (I'm open to a better name)
2025-03-19 13:29:58 -04:00
nhmall
b169b79d36 dump monster and obj weights using --dumpweights 2025-03-15 19:55:49 -04:00
nhmall
9b0724f8f2 update tested versions of Visual Studio 2025-03-13 2025-03-13 12:57:55 -04:00
nhmall
dfe2a967fc fix a recent typo 2025-03-13 07:40:20 -04:00
nhmall
4a67caf3d7 document musl=1 in README-hints 2025-03-11 10:27:18 -04:00
nhmall
fbb8ef2fa6 follow-up: set STRIPBS in Makefiles 2025-03-10 17:18:58 -04:00
nhmall
bddca2ded5 musl libc build, rather than glibc
We've had reports of a couple of issues building against musl libc.

Issues reported:
  - build procedures utilize cat for Guidebook-creation, and cat
    is deprecated in distros that use musl libc.

  - some of the CRASHREPORT code is using library functions that
    are not available in the musl libc environment. The reported
    functions were backtrace() and backtrace_symbols(), which use
    header file /usr/include/execinfo.h.

So we'll try to accommodate this. Since we don't have a means of
autodetecting the musl libc situation during the build (as of yet), the
builder will have to specify 'make musl=1' on the make command line.

Specifying 'musl=1' on the make command line will:
1. ensure that NOCRASHREPORT gets defined in the C preprocessor.
2. set COLCMD to be '../util/stripbs' instead of 'col -bx'.

Closes #1393
2025-03-10 17:14:24 -04:00
SHIRAKATA Kentaro
83bb81c624 fix Makefile.nmake when USE_DLB=N 2025-03-01 00:12:03 +09:00
nhmall
d56b0a3b7a follow-up bit for Windows console 2025-02-26 23:14:52 -05:00
nhmall
1eaafddca3 fix dolook() on Windows console
usemap boolean wasn't being set to TRUE when it should have been
2025-02-26 23:10:30 -05:00
Keni
372ebd9d80 NOSTATICFN/NONOSTATICFN typos and logic fixes 2025-02-17 11:50:55 -05:00
nhmall
f1be2eaffa add --dumpmongen to view mongen_order[] array 2025-02-14 09:38:29 -05:00
nhmall
f8773f65db update tested versions of Visual Studio 2025-02-11 2025-02-11 19:50:08 -05:00
nhkeni
cfe39900ca Demo for downloading formatted docs
Written for MacOS, more useful for Windows (but I'm not writing that).
2025-01-31 21:48:15 -05:00
PatR
29f7580fc1 analyzer lint for sys/unix/*.c sys/share/*.c win/tty/*.c
Actually only ioctl.c for sys/share.  And with all of these, only
for the conditionals used by MacOS.
2025-01-23 12:01:46 -08:00
nhmall
8de3aa564f update tested versions of Visual Studio 2025-01-19 2025-01-19 22:02:43 -05:00
nhmall
3221665f5a updates to tradstdc.h
Define a macro NH_C to provide a shorter & simpler way to test for
which C standard the build is being carried out under (c99 or c23).

 NH_C > 202300L     Being compiled under C23 or greater
 NH_C > 199900L     Being compiled under C99 or greater
 NH_C > 198900L     Being compiled under C89 or greater,
                    or C std could not be determined.

While NetHack only requires c99, we've been taking advantage
of some c23 features (attributes), if they are available,
to allow the use of ATTRNORETURN/NORETURN and FALLTHROUGH on
compilers other than gcc.

Also add some comment documentation to tradstdc.h about NetHack's
use of c99.

The sys/unix/Makefile.top change overcomes a warning in the
Makefile-generated nhlua.h. That warning arises under some compilers
that rely on attribute [[noreturn]] ahead of a declaration
(NetHack macro ATTRNORETURN), rather than the trailing gcc
__attribute((noreturn)) (NetHack macro NORETURN). The sed command
is modified to include ATTRNORETURN at the start of the declaration
in addition to the NORETURN at the end of the declaration, in the
generated file. That's the same combination that's used for the
declaration of other functions that don't return.
2025-01-19 20:51:46 -05:00
nhmall
85965b1b32 Visual Studio project files:directory name cleanup 2025-01-07 10:00:28 -05:00
nhmall
7cc118365c quiet down mips cross-compile
Even though most of these are cast to void (but not all), the
mips cross-compiler seems determined to warn about them anyway.

Suppress that particular warning altogether to quiet the build.
That is not the ideal approach, but if the normal way of whitelisting
individual cases isn't working, I'm not sure of another course of
action.
2025-01-05 15:51:11 -05:00
nhmall
a7152ad54e CROSS_TO_WASM build fix
A couple of option processing functions, one of which was called in file.c, were
recently added to sys/unix/unixmain.c, but the wasm build does not include unixmain.c,
it uses sys/libnh/libnhmain.c.

Transcribe the functions into sys/libnh/libnhmain.c.

Also, do not #include "wintty.h" for NOTTYGRAPHICS builds.
2025-01-05 05:42:24 -05:00
nhmall
be5143bb74 window-port updates
Remove start_screen() and end_screen() from the
Window-port interface.

They were only ever used by tty, and there was a comment
carried to several window-ports about how they "really
should go away. They are tty-specific"

term_start_screen() and term_end_screen() are part of
terminal/NO_TERMS supporting routines now.
2025-01-04 23:38:34 -05:00
nhmall
37758c7e48 some tty updates
Add a note about NO_TERMS to include/wintty.h for clarity.

Rename tty_startup and tty_shutdown to term_startup() and
term_shutdown(). They are found in termcap.c for !NO_TERMS
like most of the other term_ routines, as well as having
versions for several of the NO_TERMS platforms. They aren't
part of the tty_interface called from the core. The tty
implementation does call and rely on them.

Remove some conditional #ifdef's around term_shutdown()
(formerly tty_shutdown()) and just ensure that all the
tty platforms have an implementation that they can link
with, even if it is just a stub presently.

Put the protype for nethack_exit in extern.h to reduce
maintenance to a single spot, and remove it from other
locations. A warning in the msdos cross-compile led to
this change.
2025-01-04 19:01:34 -05:00
nhmall
e20908fa4f remove an unused part of msdos cross-compile 2024-12-30 12:59:00 -05:00
nhmall
ac50b7fecc update the msdos cross-compile
date.c wasn't always being recompiled.
A couple of other bits.
2024-12-30 12:52:35 -05:00
nhmall
a65c012f45 shorten up a Makefile.src line 2024-12-30 12:48:52 -05:00
nhmall
50aff17f94 follow-up bit for sys/msdos/fetch-cross-compiler.sh 2024-12-29 13:54:06 -05:00
nhmall
7b4445f040 make msdos lib/djgpp/target folder more hierarchical
Instead of flat, have bin, lib and include folders for
the native DOS pieces.

If you have been cross-compiling for MSDOS, you will
need to carry out the following to bring things up-to-date:

    sys/msdos/fetch-cross-compiler.sh
    make CROSS_TO_MSDOS=1 WANT_DEBUG=1 package
2024-12-29 12:11:03 -05:00
nhmall
556f1c9839 Windows: remove troublesome template lines
Closes #1345
2024-12-26 17:38:03 -05:00
nhmall
57f86662fd try harder to have --showpaths succeed
This helps avoid a potential chicken-and-egg scenario
with the system configuration file (sysconf).

If sysconf wasn't accessible at the expected location, it
caused an immediate exit, without relaying any helpful
information. That happened even when using:
    'nethack --showpaths'

That's particularly unhelpful, because the --showpaths
output might have been useful towards understanding where
NetHack was looking for such things.

That left you without an easy recourse to identify where
the game is looking for the sysconf file. That might be
especially troublesome if you didn't build the game
yourself.
2024-12-22 19:58:52 -05:00
nhmall
f12d755ba2 Makefile.nmake updates
Be more consistent in the use of path separators.

Add a second version of Makefile variables that contain paths,
one with a trailing separator, and one without (prefixed with R_
for use in Makefile rules).

Also, in dat/luahelper,

Updates due to correspond to the Makefile.nmake changes.

Add Makefile variable AWK to use $(AWK) instead of hardcoded awk.
2024-12-22 09:43:00 -05:00
Pasi Kallinen
f7e86aa150 Add a new bigroom variant "two hexagons" 2024-12-21 12:19:26 +02:00
nhmall
45b2a6c49a more C standard progress
There was a transcription error in the comments in cstd.h for
the standard list of header files, where only the description
remained for <stdlib.h>, not the name of the file itself.

Remove several extraneous inclusions of the standard C99 headers.

Tested on the following afterwards:
Linux (using hints/linux.370) including tty, curses, qt6, and X11
macOS (using hints/macOS.370) including tty, curses, qt5, and X11
Windows MSYS2 using sys/windows/GNUmakefile
Windows Visual Studio using sys/windows/Makefile.nmake
msdos cross-compile on Ubuntu using djgpp cross-compiler
2024-12-20 10:32:38 -05:00
nhmall
f32e766728 MIPS cross-compile bit
Use 3 additional Makefile variables
2024-12-17 19:16:00 -05:00
nhmall
6ce2ae956e simplify inclusion of debugging capability in msdos package
This build command will include line number info, gdb.exe or nhgdb.bat in the package:

        make CROSS_TO_MSDOS=1 WANT_DEBUG=1 package

This build command will not include line number info, gdb.exe or nhgdb.bat in the package:

        make CROSS_TO_MSDOS=1 package
2024-12-17 15:33:39 -05:00
nhmall
5a3795184f use bash for sys/msdos/fetch-cross-compiler.sh
bash allows arrays thus preventing duplication during fetching
2024-12-16 13:35:05 -05:00
nhmall
0a5948fffc follow-up on msdos cross-compile
Obtain gdb.exe during the execution of sys/msdosfetch-cross-compiler.sh
ahead of the build, so that the Makefile just has to move it into place.
2024-12-15 20:08:10 -05:00
nhmall
69600c3f38 add an optional deploy-to-dosbox target for msdos cross-compile
The WANT_DEBUG=1 will cause the cross-compile to include line
number information in the NetHack executable, useful for
backtraces and gdb debugging sessions.

How a developer can use the optional deploy-to-dosbox target:
    make CROSS_TO_MSDOS=1 WANT_DEBUG=1 dosbox=/mnt/c/dosbox deploy-to-dosbox

where dosbox= points to the directory which will be mounted for
your drive in dosbox

THe deploy-to-dosbox recipe ensures that a target copy of gdb.exe
ends up alongside nethack.exe at the target, including:
  - placing the source code that gdb requires on the target
    in the nhsrc subfolder.
  - an nhgdb.bat that supplies the right switches to gdb
    for locating the NetHack sources.
2024-12-15 10:26:49 -05:00
nhmall
fd7c314e9e adjust compiler switches in msdos cross-compile 2024-12-15 10:15:23 -05:00
nhmall
2965ce4bc5 msdos build correction
ENHANCED_SYMBOLS is defined by default in config.h.
The msdos build tried to #undef ENHANCED_SYMBOLS
in tilemap.c, but doing it in there created a mismatch
between the data struct definition for glyph_map in wintype.h
and the initializers generated in tilemap.c

Move the msdos build catch for ENHANCED_SYMBOLS to
one single place in config1.h so that the code and data agree.
2024-12-15 09:53:50 -05:00
nhmall
c7739171a2 follow-up: consoletty.c 2024-12-12 22:46:44 -05:00