Commit Graph
19282 Commits
Author SHA1 Message Date
Ingo Paschke 15e3973ac2 Amiga: tighten input/dialog buffer bounds
Right-size the Intuition string-gadget buffer to BUFSZ so a caller
with a BUFSZ-sized buffer cannot be overflowed.  Enlarge the
amii_yn_function prompt buffer to fit the worst-case query + resp
+ def + trailing space and switch the appends to Snprintf with
remaining-space tracking.  Replace sprintf in amii_display_file's
"Can't display X: Y" path with Snprintf.  In EditColor's Save path
drop the strcpy/strcat chain that could trail off the end of
oname/nname when dirname returned a near-full path; use Snprintf
instead.  Rewrite dirname() to copy first and truncate the copy,
so it no longer briefly NULs the caller's string.
2026-05-12 15:24:15 +02:00
Ingo Paschke d99eeb17c2 Amiga: header hygiene and palette-size constants
Add AMII_PALETTE_SIZE / AMIV_PALETTE_SIZE in amiconf.h to make the
actual populated portion of the init-map arrays explicit.  Drop the
redundant extern void exit() declaration.  Annotate Abort with
NORETURN in both amiconf.h and winproto.h; drop the duplicate Abort
declaration further down winproto.h.

Convert the bare-token "CLIPPING must be defined" assertion in
windefs.h into a real #error directive.

Comment in winext.h to disambiguate the three similarly named
amii*_init*map palette arrays.
2026-05-12 15:21:23 +02:00
Ingo Paschke ebcf31a4da Amiga: drop UNTESTED AROS path; tighten fopenp separator write
The UNTESTED #ifdef in freediskspace was never gated by any hints
file, so the unsigned-long-long path could only be enabled by a
stray manual #define -- in which case the return type is still
long and silently truncates.  Remove the branches.

In fopenp the separator '/' write was unchecked: when the path
segment exactly filled the buffer to BUFSIZ-2 it would land at
buf[BUFSIZ-1] and the follow-on NUL would write past the end.
Guard the write.
2026-05-12 15:19:28 +02:00
Ingo Paschke 157c005f02 Amiga: harden host-side bmp/xpm to iff converters
Replace #pragma-pack BMP header reads with little-endian byte
readers so the tool works on any host endianness.  Add dimension
and color-count range checks, zero-init pixel remap table, check
calloc, free bmpdata on early returns, send malloc errors to
stderr.  Add bp>xbuf guards to xpmgetline's strip loop.
2026-05-12 15:18:44 +02:00
Ingo Paschke cb46d9effd Amiga: tighten two minor issues from review
- amii_set_text_font called CloseLibrary(DiskfontBase) outside the
  OpenLibrary guard; on Kickstart V36+ that is a no-op for a NULL
  handle, but on V33/V34 it is undefined.  Move the close inside
  the if-block where DiskfontBase is known non-NULL.
- amii_get_ext_cmd's bounds check used BUFSZ for an obufp[100]
  buffer; the tighter COLNO check actually bounded it but the
  expression was misleading.  Use sizeof obufp.
2026-05-12 15:12:07 +02:00
Ingo Paschke 74c87caac3 Amiga: fix bitmap/IFF resource handling in winchar.c
- MyAllocBitMap left bm->bm.Planes[] uninitialized; InitBitMap only
  fills BytesPerRow/Rows/Flags/Depth, not Planes[].  If AllocRaster
  fails mid-loop, MyFreeBitMap was iterating up to Depth and would
  pass uninitialized stack-garbage pointers to FreeRaster.  Zero
  Planes[] before the alloc loop.
- ReadImageFile leaked iffparse.library, the IFFHandle, the DOS file
  handle, and any open-IFF state on every panic path.  On AmigaOS
  those handles are not auto-reclaimed when the process dies, so
  each failure stranded resources until reboot.  Restructure to a
  single cleanup label and free in reverse-acquisition order before
  panicking.
- OpenIFF returns an error code that was being thrown away, so a
  failed open would feed corrupt state to ParseIFF.  Check and
  bail.
2026-05-12 15:12:07 +02:00
Ingo Paschke f583787825 Amiga: fix overview-window crashes
- MyAllocBitMap left bm->mflags uninitialized, so MyFreeBitMap took the
  wrong path between FreeRaster and FreeMem and intermittently corrupted
  exec's free list (Software Failure 0x81000005, DEADEND in FreeMem).
- The NHW_OVER window is BORDERLESS, so attaching WINDOWSIZING |
  WINDOWDRAG | WINDOWCLOSE created phantom gadgets that hit-test against
  unrelated input.  Pressing ESC while the overview was selected fired
  CLOSEWINDOW and destroyed the window underneath the running code,
  leading to wild-PC crashes.  Drop the gadget flags; SHIFT-HELP already
  toggles the overview cleanly via delayed_key_action.
- amii_destroy_nhwindow only reset WIN_MAP / WIN_STATUS / WIN_MESSAGE /
  WIN_INVEN; WIN_OVER and WIN_BASE kept pointing at freed slots, so any
  later 'WIN_X != WIN_ERR && amii_wins[WIN_X]->win' check dereferenced
  NULL.  Reset them too.
2026-05-12 15:12:07 +02:00
Ingo Paschke 7c8524ae37 Amiga: make amigapkg depend on $(GAMEBIN)
Without the dependency, 'make amigapkg' would copy whatever was
already in targets/amiga/ without ever rebuilding when sources
changed -- silently shipping a stale binary.
2026-05-12 15:12:07 +02:00
Ingo Paschke 657f6eaad9 Amiga: fix latent issues found in code review
- fname[18]/sprintf risks overflow for >=10 in any version field;
  switch to snprintf into a wider static buffer.
- (1L << i) for i==31 (or shifting into the depth-loop terminator)
  is undefined for signed long; use 1UL.
- Drop unused cnt= from amii_display_nhwindow's DoMenuScroll call;
  the menu return value is consumed elsewhere, not here.
2026-05-12 15:12:07 +02:00
nhmall 7d802883bc replace hard-coded nroff with $(NROFF) 2026-05-12 09:07:06 -04:00
nhmall 80a99d1ed1 stop init of allopt[] from wiping out disregards 2026-05-12 00:10:38 -04:00
nhmall f5456fa92c another Windows issue causing startup grief 2026-05-11 22:59:42 -04:00
nhmall d62b56e0f2 yet more hints file prep 2026-05-11 20:45:49 -04:00
nhmall ccb3db39d7 more hints file prep 2026-05-11 19:59:53 -04:00
nhmall ef600a41f6 allow a hints file to be able to specify GUIDECMD
define GUIDECMD in sys/unix/Makefile.doc using '?=' notation
2026-05-11 19:16:03 -04:00
PatR c42d35eac0 avoid newsym(0,0) for vault guard
When a vault guard is being moving off the map to <0,0> to wait until
his temporary corridor gets removed, don't try to update the map for
that off-the-screen location in order to avoid triggering impossible()
from newsym().

Plus a trivial tweak to NH_abort().  Its argument is never modified so
declare it as such.
2026-05-11 15:06:13 -07:00
nhmall 45ab4eb1aa follow-up: paste error snuck in 2026-05-11 17:40:50 -04:00
nhmall f06e2389b6 more fixes5-0-1.txt updates 2026-05-11 17:36:21 -04:00
nhmall 3b5e784c69 fixes5-0-1.txt catch-up 2026-05-11 17:07:17 -04:00
nhw_cron 34204d0874 This is cron-daily v1-May-7-2026. 000files updated: Files 2026-05-11 16:27:48 -04:00
nhmall 48fa545cf5 update Contributing.md 2026-05-11 16:25:14 -04:00
nhmall 9bfaa066e2 Merge branch 'cleanup' of https://github.com/ingpaschke/NetHack into NetHack-5.0 2026-05-11 15:43:56 -04:00
nhmall 3ca18c8e44 be more cautious on gcc version for warning 2026-05-11 15:40:29 -04:00
nhmall 0991b0e770 tiletext.c warning suppression 2026-05-11 15:30:53 -04:00
nhkeni 3973944a93 Fix subst for luahelper. 2026-05-11 15:22:06 -04:00
Ingo Paschke 1cfff0f002 Amiga: correct command-line flag doc in amii.hlp
Wizard mode is gated on player name == WIZARD_NAME, not on -D or
-debug.  Document -uwizard as the working entry point.
2026-05-11 20:51:06 +02:00
Ingo Paschke d1a84de8fc Amiga: delete outdated/sys/amiga/
These 3.4.1-era files are superseded: Build/Install.ami -> README.amiga;
Makefile.ami/.agc -> sys/unix/hints/include/cross-*.500;
NetHack.cnf -> sys/amiga/nethack.cnf;
txt2iff/xpm2iff.c -> sys/amiga/*_host.c.
2026-05-11 20:51:06 +02:00
Ingo Paschke 2e61bf768f Amiga: fix port_help double-prefix path
display_file -> dlb_fopen -> fopen_datafile already prepends DATAPREFIX;
wrapping PORT_HELP in fqname() too produced "NetHack:NetHack:amii.hlp".
2026-05-11 20:51:06 +02:00
Ingo Paschke 344063afb6 Amiga: route non-menu messages from DoMenuScroll to ProcessMessage
DoMenuScroll dropped IDCMP messages for non-owner windows -- so a
resize of WIN_INVEN or close-gadget on WIN_OVER during a menu never
reached the game state.  Forward those to ProcessMessage;
VANILLAKEY/RAWKEY stay with the menu.
2026-05-11 20:51:06 +02:00
Ingo Paschke 8dbbbc2fef Amiga: deduplicate amii_procs and amiv_procs
Factor common body into AMI_WIN_PROCS_BODY.  The POSITIONBAR / CLIPPING /
CHANGE_COLOR guards in the original were dead.
2026-05-11 20:51:06 +02:00
Ingo Paschke c85a8cf607 Amiga: drop redundant 'either windowtype' guards
Six if(WINVERS_AMIV || WINVERS_AMII) sites are always true with
amitty.c gone.
2026-05-11 20:51:06 +02:00
Ingo Paschke 5d86dfccb5 Amiga: replace WINVERS_AMI* strcmp with WINDOWPORT() id compare
The macros were strcmp("amiv", windowprocs.name)==0 at every reference
-- 72 sites including inner loops.  Use the 5.0 core's WINDOWPORT(wn)
which compares wp_id.
2026-05-11 20:51:06 +02:00
Ingo Paschke 688f9344cd Amiga: route port paths through fqname()
Tile loading hard-coded "NetHack:tiles/tiles{16,32}.iff" and PORT_HELP
hard-coded "nethack:amii.hlp".  Route through fqname(DATAPREFIX) so
DATADIR= overrides apply.  Refresh amii.hlp to 5.0 content, ship it via
amigapkg, and document HACKDIR / SAVEDIR / BONESDIR examples in
nethack.cnf.
2026-05-11 20:51:06 +02:00
nhkeni df9673c96e Make all top-level .md files subject to nhsub substitutions. 2026-05-11 14:46:06 -04:00
Ingo Paschke c5d8ab1985 Amiga: collapse #ifndef CROSS_TO_AMIGA include forks
Every #include block had a paired NH: assign path for native builds.
Only the cross-compile path is built now.
2026-05-11 20:43:08 +02:00
Ingo Paschke 010c068861 Amiga: clean up amiconf.h
Remove legacy compiler guards and stale extern declarations (the
ami_wbench_* family, CopyFile, ami_argset, ami_mkargline, FromWBench).
Drop unused AMII_*_VOLUME / DEFAULT_ICON macros and the
IDCMP_CLOSEWINDOW auto-define.
2026-05-11 20:43:08 +02:00
Ingo Paschke 94a74b84d8 Amiga: drop OPT_DISPMAP / display_map / fast_map machinery
display_map() was never integrated; no .c defines it.  All OPT_DISPMAP /
DISPMAP / sysflags.fast_map conditionals were unreachable.
2026-05-11 20:43:08 +02:00
Ingo Paschke 7b559f4d02 Amiga: delete dead files and dead-macro code
Delete amigst.c (empty) and amitty.c (TTY/BBS stub).  Drop WINVERS_AMIT,
SUPERBITMAP_MAP, EXTMENU, SHELL/dosh(), and the bbs_id reference in
src/files.c.
2026-05-11 20:30:45 +02:00
Ingo Paschke beaed3aa08 Amiga: delete the .p prototype headers
amidos.p, amiwind.p, winami.p duplicated and partly contradicted
winproto.h.  Switch amidos.c and amigst.c to winproto.h.
2026-05-11 20:30:45 +02:00
Ingo Paschke e90a297021 Amiga: drop #if 0 dead-code blocks
Includes a dead amii_player_selection / RandomWindow pair (~280 lines),
eraseall / CopyFile in amidos.c, and smaller fragments.
2026-05-11 20:30:45 +02:00
Ingo Paschke 00433c7998 Amiga: drop TESTING dev toggle in winchar.c 2026-05-11 20:30:45 +02:00
Ingo Paschke a8e54185eb Amiga: drop SHAREDLIB dead build flavor 2026-05-11 20:29:47 +02:00
Ingo Paschke 7b67da20b7 Amiga: make INTUI_NEW_LOOK unconditional
OS 2.0+ Intuition is required; the pre-2.0 fallback paths are unreachable.
2026-05-11 20:29:47 +02:00
Ingo Paschke f0b6ddc6f8 Amiga: drop legacy non-gcc compiler guards
Remove AZTEC_C, _DCC, SASC, LATTICE, MANX arms. The port targets bebbo gcc.
2026-05-11 20:29:47 +02:00
Ingo Paschke 22ddba7c1e Amiga: more review fixes
- NHW_BASE / NHW_OVER collided with NHW_PERMINVENT=6; renumber off NHW_LAST_TYPE.
- GlyphToIcon used > 10000 instead of >=.
- make_menu_items sized array by sizeof(amii_menu_item) instead of menu_item.
- DoMenuScroll could deref NULL amip on SELECTUP.
- get_nhuuid uses ISAAC64 rn2() instead of hand-rolled LCG.
- fopenp's bound check fired one byte too late.
- winami.p had stale signatures for amii_end_menu, amii_select_menu, amii_suspend_nhwindows.
2026-05-11 20:29:47 +02:00
Ingo Paschke f8ea34489f Amiga: fix three latent bugs found in code review
amiv_lprint_glyph used uninitialized 'base'; amii_clear_nhwindow
compared cw->type to a winid; amii_sethipens fell through.
2026-05-11 20:29:47 +02:00
nhw_cron 66c97eaab3 This is cron-daily v1-May-7-2026. 005guidebook updated: doc/Guidebook.txt 2026-05-11 13:44:16 -04:00
nhmall b2cf7d5a84 Guidebook datestamp to most recent commit 2026-05-11 12:33:35 -04:00
nhmall e8e8749c25 move header to bottom of the Contributing.md file 2026-05-11 12:18:17 -04:00
nhw_cron 7c14ed2723 This is cron-daily v1-May-7-2026. 000files updated: Files 2026-05-11 11:55:40 -04:00