diff --git a/sys/amiga/amidos.c b/sys/amiga/amidos.c index 01d33343f..c07c52884 100644 --- a/sys/amiga/amidos.c +++ b/sys/amiga/amidos.c @@ -30,6 +30,23 @@ int getpid(void) { return (int)FindTask(NULL); } #endif +/* Point NetHack: at the directory we were launched from. Works for both + CLI ("nethack") and Workbench (icon double-click) launches, since + GetProgramDir() (V37+) resolves both. Any existing assign is replaced; + it would just be stale state from a previous install or session. */ +void +amiga_self_assign(void) +{ + BPTR dup; + + if (GetProgramDir() == 0) + return; + if ((dup = DupLock(GetProgramDir())) == 0) + return; + if (!AssignLock("NetHack", dup)) + UnLock(dup); +} + #ifdef AZTEC_50 #include #undef strcmpi diff --git a/sys/amiga/amidos.p b/sys/amiga/amidos.p index ed669f563..83decbc17 100644 --- a/sys/amiga/amidos.p +++ b/sys/amiga/amidos.p @@ -18,6 +18,7 @@ int abs(int ); #endif int tgetch (void); int dosh (void); +void amiga_self_assign (void); long freediskspace(char *); long filesize(char *); void eraseall(const char * , const char *); diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 3ad30b682..56ee47938 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -255,6 +255,8 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ #endif } #ifdef AMIGA + /* Point NetHack: at our program directory; covers CLI and WB launch. */ + amiga_self_assign(); #ifdef CHDIR /* * If we're dealing with workbench, change the directory. Otherwise diff --git a/sys/unix/hints/include/cross-pre1.500 b/sys/unix/hints/include/cross-pre1.500 index b252f0843..9c8c0a24c 100644 --- a/sys/unix/hints/include/cross-pre1.500 +++ b/sys/unix/hints/include/cross-pre1.500 @@ -42,6 +42,7 @@ ifdef CROSS_TO_AMIGA CROSS=1 BUILD_TARGET_LUA=1 CROSS_SHARED=1 +HACKDIR=NetHack: override TARGET = amiga override TARGETDIR=../targets/$(TARGET) override TARGETPFX = $(TARGETDIR)/