Amiga: auto-assign NetHack: to the program directory

This commit is contained in:
Ingo Paschke
2026-05-04 15:33:14 +02:00
parent 82efba55f2
commit 9a909be7c5
4 changed files with 21 additions and 0 deletions
+17
View File
@@ -30,6 +30,23 @@
int getpid(void) { return (int)FindTask(NULL); } int getpid(void) { return (int)FindTask(NULL); }
#endif #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 #ifdef AZTEC_50
#include <functions.h> #include <functions.h>
#undef strcmpi #undef strcmpi
+1
View File
@@ -18,6 +18,7 @@ int abs(int );
#endif #endif
int tgetch (void); int tgetch (void);
int dosh (void); int dosh (void);
void amiga_self_assign (void);
long freediskspace(char *); long freediskspace(char *);
long filesize(char *); long filesize(char *);
void eraseall(const char * , const char *); void eraseall(const char * , const char *);
+2
View File
@@ -255,6 +255,8 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
#endif #endif
} }
#ifdef AMIGA #ifdef AMIGA
/* Point NetHack: at our program directory; covers CLI and WB launch. */
amiga_self_assign();
#ifdef CHDIR #ifdef CHDIR
/* /*
* If we're dealing with workbench, change the directory. Otherwise * If we're dealing with workbench, change the directory. Otherwise
+1
View File
@@ -42,6 +42,7 @@ ifdef CROSS_TO_AMIGA
CROSS=1 CROSS=1
BUILD_TARGET_LUA=1 BUILD_TARGET_LUA=1
CROSS_SHARED=1 CROSS_SHARED=1
HACKDIR=NetHack:
override TARGET = amiga override TARGET = amiga
override TARGETDIR=../targets/$(TARGET) override TARGETDIR=../targets/$(TARGET)
override TARGETPFX = $(TARGETDIR)/ override TARGETPFX = $(TARGETDIR)/