shithub: duke3d

Download patch

ref: 08e6666c5a1665c22175da3609b209c1bff1671e
parent: 5a9312c9cc836fb66343d38dbfa84b3b22368399
author: Jacob Moody <[email protected]>
date: Tue Feb 7 19:14:35 EST 2023

use /sys/games/lib/duke3d for grp file

--- a/Engine/src/filesystem.c
+++ b/Engine/src/filesystem.c
@@ -62,14 +62,18 @@
 uint8_t         crcBuffer[ 1 << 20]     ;
 int32_t initgroupfile(const char  *filename)
 {
-	uint8_t         buf[16]                 ;
-	int32_t         i, j, k                 ;
-    grpArchive_t*   archive                 ;
+	uint8_t	buf[16];
+	char namebuf[512], *path;
+	int32_t i, j, k;
+	grpArchive_t* archive;
     
+	if((path = getGameDir())[0] == 0)
+		snprint(namebuf, sizeof namebuf, "/sys/games/lib/duke3d/%s", filename);
+	else
+		snprint(namebuf, sizeof namebuf, "%s/%s", path, filename);
     
+	printf("Loading %s ...\n", namebuf);
     
-	printf("Loading %s ...\n", filename);
-    
 	if (grpSet.num == MAXGROUPFILES){
         printf("Error: Unable to open an extra GRP archive <= No more slot available.\n");
         return(-1);
@@ -83,10 +87,10 @@
 	//groupfil_memory[numgroupfiles] = NULL; // addresses of raw GRP files in memory
 	//groupefil_crc32[numgroupfiles] = 0;
     
-	archive->fileDescriptor = open(filename,O_BINARY|O_RDONLY);
+	archive->fileDescriptor = open(namebuf,O_BINARY|O_RDONLY);
     
     if (archive->fileDescriptor < 0){
-        printf("Error: Unable to open file %s.\n",filename);
+        printf("Error: Unable to open file %s.\n",namebuf);
         getchar();
         exit(0);
     }
--- a/Game/src/game.c
+++ b/Game/src/game.c
@@ -8031,7 +8031,7 @@
             strcat(directoryToScan,"/");
     }
     else{
-        strcat(directoryToScan, "./");    
+        strcat(directoryToScan, "/sys/games/lib/duke3d/");
     }
     
     printf("Scanning directory '%s' for a GRP file like '%s'.\n",directoryToScan,baseDir);