From 688f9344cd1254cccf132ccfb1d73b95164989f3 Mon Sep 17 00:00:00 2001 From: Ingo Paschke Date: Mon, 11 May 2026 17:00:47 +0200 Subject: [PATCH] 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. --- include/amiconf.h | 2 +- sys/amiga/amii.hlp | 82 +++++++++++++++++++-------- sys/amiga/amiwind.c | 10 ++-- sys/amiga/nethack.cnf | 14 +++++ sys/amiga/windefs.h | 1 - sys/amiga/winfuncs.c | 16 +++--- sys/unix/hints/include/cross-post.500 | 1 + 7 files changed, 88 insertions(+), 38 deletions(-) diff --git a/include/amiconf.h b/include/amiconf.h index eda8b3022..47306f9d2 100644 --- a/include/amiconf.h +++ b/include/amiconf.h @@ -86,7 +86,7 @@ extern void ami_wininit_data(int); #define AMII_MAXCOLORS (1L << DEPTH) typedef unsigned short AMII_COLOR_TYPE; -#define PORT_HELP "nethack:amii.hlp" +#define PORT_HELP "amii.hlp" #undef TERMLIB diff --git a/sys/amiga/amii.hlp b/sys/amiga/amii.hlp index 88716f05e..13d59ffc6 100644 --- a/sys/amiga/amii.hlp +++ b/sys/amiga/amii.hlp @@ -1,31 +1,63 @@ - Amiga-specific help file for NetHack 3.6 + Amiga-specific help for NetHack 5.0 -The Amiga port of NetHack supports a number of additional commands -and facilities specific to the Amiga. Listed below are the things -which are either specific to the Amiga port or might not appear -in other ports. -While playing NetHack you can press: +Special key combinations +------------------------ + ALT-HELP Edit the screen colour palette. + CTL-HELP Set tile scaling and clipping (amiv only). + SHIFT-HELP Toggle the dungeon overview window (amiv only). - ALT-HELP Color requestor. - CTL-HELP Scale display (amitile only). - SHIFT-HELP Overview window (amitile only). -Amiga-specific run-time options: - altmeta use the alt keys as meta keys - flush throw away keyboard type-ahead +Command-line flags +------------------ + -L Force interlaced (tall) screen. + -l Force non-interlaced screen. -Command line options recognized are +The usual core flags (-D, -X, -u, -p, -r, -@) apply too. - -n No News at game startup. - -X Play in discovery mode. - -D Play in debug mode. - -L Interlaced screen. - -l Never Interlaced screen. - -u Play as player given as - an argument. - -r Pick a race given as an - argument. - -p Pick a profession given - as an argument - -? Gives command line usage. + +Configuration (nethack.cnf in the NetHack: drawer) +-------------------------------------------------- +Window backend selection: + + OPTIONS=windowtype:amiv tile graphics (default) + OPTIONS=windowtype:amii text/character mode + +Amiga-specific runtime options: + + OPTIONS=altmeta ALT+letter sends META+letter (default on). + Disable with !altmeta if your keymap needs + ALT for typing accented characters. + OPTIONS=flush drop any keys queued during long operations + OPTIONS=asksavedisk prompt for a save-disk before saving + (MFLOPPY only) + + +File-location overrides +----------------------- +NetHack: is automatically assigned to the directory the executable was +launched from. All game files default to that volume. Override any of +these in nethack.cnf to relocate parts of the game state: + + HACKDIR=NetHack: program / shared data + LEVELDIR=NetHack: per-level files during play + SAVEDIR=NetHack:save/ save files + BONESDIR=NetHack:bones/ bones files (shared between games) + DATADIR=NetHack: nhdat and other data files + SCOREDIR=NetHack: record / logfile + LOCKDIR=NetHack: lock files + CONFIGDIR=NetHack: per-user config + +You can also override the install path entirely without editing the cnf +by setting the NETHACKDIR or HACKDIR shell environment variable before +launching: + + setenv NETHACKDIR Work:games/nethack-dev/ + Work:games/nethack-dev/nethack + + +Display fallback +---------------- +Tile mode (amiv) requires at least 16 colours and ~384 KB free chip +RAM. If neither is available the game falls back to text mode (amii) +at startup with a one-line note. diff --git a/sys/amiga/amiwind.c b/sys/amiga/amiwind.c index 5ad6cb503..7cb1dcc88 100644 --- a/sys/amiga/amiwind.c +++ b/sys/amiga/amiwind.c @@ -59,15 +59,17 @@ struct TextFont *TextsFont = NULL; struct TextFont *HackFont = NULL; struct TextFont *RogueFont = NULL; -UBYTE FontName[] = "NetHack:hack.font"; -/* # chars in "NetHack:": */ -#define SIZEOF_DISKNAME 8 +/* hack.font is registered via NetHack:hack.font (which references + * NetHack:hack/8). OpenFont()/SetFont() take the bare name; only + * OpenDiskFont() needs the full path. */ +UBYTE HackFontName[] = "hack.font"; +UBYTE HackFontPath[] = "NetHack:hack.font"; #endif struct TextAttr Hack80 = { #ifdef HACKFONT - &FontName[SIZEOF_DISKNAME], + HackFontName, #else (UBYTE *) "topaz.font", #endif diff --git a/sys/amiga/nethack.cnf b/sys/amiga/nethack.cnf index 95952d6a6..b9083d935 100644 --- a/sys/amiga/nethack.cnf +++ b/sys/amiga/nethack.cnf @@ -47,3 +47,17 @@ MENUCOLOR="gray dragon scale"=cyan MENUCOLOR="speed boots"=magenta MENUCOLOR="luckstone"=green MENUCOLOR="unicorn horn"=green + +# *** FILE LOCATIONS *** +# NetHack: is auto-assigned to the directory the binary was launched +# from, so all game files default there. Uncomment any of these to +# relocate part of the game state to a different volume or subdir. +# +#HACKDIR=NetHack: +#LEVELDIR=NetHack: +#SAVEDIR=NetHack:save/ +#BONESDIR=NetHack:bones/ +#DATADIR=NetHack: +#SCOREDIR=NetHack: +#LOCKDIR=NetHack: +#CONFIGDIR=NetHack: diff --git a/sys/amiga/windefs.h b/sys/amiga/windefs.h index 07f6da180..3cd04ee5d 100644 --- a/sys/amiga/windefs.h +++ b/sys/amiga/windefs.h @@ -100,7 +100,6 @@ CLIPPING must be defined for the AMIGA version #define NewWindow ExtNewWindow #define NewScreen ExtNewScreen -#define SIZEOF_DISKNAME 8 #define CSI '\x9b' #define NO_CHAR -1 diff --git a/sys/amiga/winfuncs.c b/sys/amiga/winfuncs.c index 46abfd165..5ccb16313 100644 --- a/sys/amiga/winfuncs.c +++ b/sys/amiga/winfuncs.c @@ -1012,9 +1012,11 @@ amii_init_nhwindows(int *argcp, char **argv) */ if (DiskfontBase = OpenLibrary("diskfont.library", amii_libvers)) { - Hack80.ta_Name -= SIZEOF_DISKNAME; + extern UBYTE HackFontName[], HackFontPath[]; + + Hack80.ta_Name = HackFontPath; HackFont = OpenDiskFont(&Hack80); - Hack80.ta_Name += SIZEOF_DISKNAME; + Hack80.ta_Name = HackFontName; /* Textsfont13 is filled in with "FONT=" settings. The default is * courier/13. @@ -1025,9 +1027,9 @@ amii_init_nhwindows(int *argcp, char **argv) /* Try hack/8 for texts if no user specified font */ if (TextsFont == NULL) { - Hack80.ta_Name -= SIZEOF_DISKNAME; + Hack80.ta_Name = HackFontPath; TextsFont = OpenDiskFont(&Hack80); - Hack80.ta_Name += SIZEOF_DISKNAME; + Hack80.ta_Name = HackFontName; } /* If no fonts, make everything topaz 8 for non-view windows. @@ -1205,10 +1207,10 @@ amii_init_nhwindows(int *argcp, char **argv) if (WINVERS_AMIV) { extern char *tilefile; if (amii_numcolors >= 32) { - tilefile = "NetHack:tiles/tiles32.iff"; + tilefile = (char *) fqname("tiles/tiles32.iff", DATAPREFIX, 0); amii_numcolors = 32; } else { - tilefile = "NetHack:tiles/tiles16.iff"; + tilefile = (char *) fqname("tiles/tiles16.iff", DATAPREFIX, 0); } amii_bmhd = ReadTileImageFiles(); } else @@ -1967,7 +1969,7 @@ removetopl(int cnt) void port_help(void) { - display_file(PORT_HELP, 1); + display_file(fqname(PORT_HELP, DATAPREFIX, 0), 1); } #endif diff --git a/sys/unix/hints/include/cross-post.500 b/sys/unix/hints/include/cross-post.500 index 51357dafb..42e562690 100644 --- a/sys/unix/hints/include/cross-post.500 +++ b/sys/unix/hints/include/cross-post.500 @@ -321,6 +321,7 @@ amigapkg: $(AMITILES) ../util/uudecode ( cd $(TARGETPFX)pkg/NetHack && ../../../../util/uudecode ../../../../sys/amiga/amifont.uu ) cp $(AMISRC)/nethack.cnf $(TARGETPFX)pkg/NetHack/nethack.cnf cp $(AMISRC)/README.amiga $(TARGETPFX)pkg/NetHack/README.amiga + cp $(AMISRC)/amii.hlp $(TARGETPFX)pkg/NetHack/amii.hlp ( cd $(TARGETPFX)pkg/NetHack && ../../../../util/uudecode ../../../../sys/amiga/NHinfo.uu ) ( cd $(TARGETPFX)pkg/NetHack && ../../../../util/uudecode ../../../../sys/amiga/cnf-info.uu ) ( cd $(TARGETPFX)pkg/NetHack && ../../../../util/uudecode ../../../../sys/amiga/license-info.uu )