shithub: qk1

Download patch

ref: e84be7125ed52c674b2d46550751e56e18fe8356
parent: 05455d82d6bd6d707c8fac3bff07a29d8a2b0ecf
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Dec 11 20:18:53 EST 2023

fs: store lump's dir as fs_lmpfrom

--- a/dat.h
+++ b/dat.h
@@ -23,6 +23,7 @@
 
 extern char fsdir[];
 extern u16int crcn;
+extern char *fs_lmpfrom;
 
 extern char savs[][Nsavcm];
 extern int savcanld[];
--- a/fs.c
+++ b/fs.c
@@ -2,6 +2,7 @@
 
 u16int crcn;
 char fsdir[Nfspath];
+char *fs_lmpfrom;
 
 typedef struct Lump Lump;
 typedef struct Pak Pak;
@@ -322,6 +323,7 @@
 	Pak *p;
 	Lump *l;
 
+	fs_lmpfrom = nil;
 	for(pl=pkl; pl != nil; pl=pl->pl){
 		if(pl->p != nil){
 			p = pl->p;
@@ -331,6 +333,7 @@
 					fseek(p->bf, l->ofs, SEEK_SET);
 					if(len != nil)
 						*len = l->len;
+					fs_lmpfrom = pl->f;
 					return p->bf;
 				}
 				l++;
@@ -342,6 +345,7 @@
 			continue;
 		if(len != nil)
 			*len = bsize(bf);
+		fs_lmpfrom = pl->f;
 		return bf;
 	}
 	werrstr("openlmp %s: not found", f);
@@ -858,6 +862,7 @@
 			break;
 		}
 		pl = Hunk_Alloc(sizeof *pl);
+		strncpy(pl->f, d, sizeof(pl->f)-1);
 		pl->p = p;
 		pl->pl = pkl;
 		pkl = pl;