From c3b97f0983a2c7a7c6af810403136aea573850bc Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 4 Dec 2018 06:15:53 +0000 Subject: [PATCH] open 'foo.fmf' in preference to 'default.fmf' when running eg foo_x86.exe. This should make TCs a little easier to release/maintain within eg quake's basedir, without breaking other TCs mods in the same basedir. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5352 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/fs.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/engine/common/fs.c b/engine/common/fs.c index 472bafdae..7ffcdfffd 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -5293,10 +5293,22 @@ ftemanifest_t *FS_ReadDefaultManifest(char *newbasedir, size_t newbasedirsize, q //hopefully this will be used for TCs. if (!man && game == -1) { + char exename[MAX_QPATH]; + COM_StripAllExtensions(COM_SkipPath(com_argv[0]), exename, sizeof(exename)); + //take away any amd64/x86/x86_64 postfix, so that people can have multiple cpu arch binaries sharing a single fmf + if (strlen(exename) > strlen(ARCH_CPU_POSTFIX) && !strcmp(exename+strlen(exename)-strlen(ARCH_CPU_POSTFIX), ARCH_CPU_POSTFIX)) + exename[strlen(exename)-strlen(ARCH_CPU_POSTFIX)] = 0; + //and then the trailing _ (before said postfix) + if (exename[strlen(exename)] == '_') + exename[strlen(exename)] = 0; + //and hopefully we now have something consistent that we can try to use. + + f = VFSOS_Open(va("%s%s.fmf", newbasedir, exename), "rb"); #ifdef BRANDING_NAME - f = VFSOS_Open(va("%s"STRINGIFY(BRANDING_NAME)".fmf", newbasedir), "rb"); if (!f) + f = VFSOS_Open(va("%s"STRINGIFY(BRANDING_NAME)".fmf", newbasedir), "rb"); #endif + if (!f) f = VFSOS_Open(va("%sdefault.fmf", newbasedir), "rb"); if (f) {