Skip to content

Commit

Permalink
Fix -neopath for Linux (NeotokyoRebuild#597)
Browse files Browse the repository at this point in the history
* Fix -neopath on Linux

* Update -neopath info

Now works on Linux
  • Loading branch information
Rainyan authored Sep 19, 2024
1 parent 7b222e0 commit 79a8ce0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ Another way is just add the `-game` option to "Source SDK Base 2013 Multiplayer"
```

### `-neopath` - Pointing to a non-default original NEOTOKYO directory
NOTE: This doesn't work on linux when running the mod from Steam.

This is generally isn't necessary if NEOTOKYO is installed at a default location. However,
if you have it installed at a different location, adding `-neopath` to the launch option
Expand Down
12 changes: 4 additions & 8 deletions mp/src/game/shared/neo/neo_mount_original.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ void FixIncompatibleNeoAssets(IFileSystem* filesystem, bool restoreInstead)
const bool callerIsClientDll = false; // always server here. should refactor this stuff later.

// The NeotokyoSource root asset folder should exist (or be symlinked) to one of these paths,
// or be specified with the NEO_PATH_PARM_CMD parm (which is currently broken on Linux, see below).
// or be specified with the NEO_PATH_PARM_CMD parm.
// We look in the order described below, and stop looking at the first matching path.
char neoLinuxPath_LocalSteam[MAX_PATH]{ 0 };
char neoLinuxPath_LocalShare[MAX_PATH]{ 0 };
Expand All @@ -370,10 +370,8 @@ void FixIncompatibleNeoAssets(IFileSystem* filesystem, bool restoreInstead)
// Third lookup path: machine's share directory.
const char* neoLinuxPath_UsrShare = "/usr/share/neotokyo/NeotokyoSource/";

// NEO FIXME (Rain): getting this ParmValue from Steam Linux client seems to be broken(?),
// we always fall back to hardcoded pDefaultVal.
V_strcpy_safe(neoPath,
CommandLine()->ParmValue(NEO_PATH_PARM_CMD, neoLinuxPath_LocalSteam));
CommandLine()->ParmValue(&NEO_PATH_PARM_CMD[0], neoLinuxPath_LocalSteam));

const bool isUsingCustomParm = (Q_stricmp(neoPath, neoLinuxPath_LocalSteam) != 0);

Expand Down Expand Up @@ -480,7 +478,7 @@ inline bool FindOriginalNeotokyoAssets(IFileSystem *filesystem, const bool calle
// NEO TODO (Rain): this linux path get code is repeated; should turn into a function for brevity.

// The NeotokyoSource root asset folder should exist (or be symlinked) to one of these paths,
// or be specified with the NEO_PATH_PARM_CMD parm (which is currently broken on Linux, see below).
// or be specified with the NEO_PATH_PARM_CMD parm.
// We look in the order described below, and stop looking at the first matching path.
char neoLinuxPath_LocalSteam[MAX_PATH] { 0 };
char neoLinuxPath_LocalShare[MAX_PATH] { 0 };
Expand All @@ -499,10 +497,8 @@ inline bool FindOriginalNeotokyoAssets(IFileSystem *filesystem, const bool calle
// Third lookup path: machine's share directory.
const char *neoLinuxPath_UsrShare = "/usr/share/neotokyo/NeotokyoSource/";

// NEO FIXME (Rain): getting this ParmValue from Steam Linux client seems to be broken(?),
// we always fall back to hardcoded pDefaultVal.
V_strcpy_safe(neoPath,
CommandLine()->ParmValue(NEO_PATH_PARM_CMD, neoLinuxPath_LocalSteam));
CommandLine()->ParmValue(&NEO_PATH_PARM_CMD[0], neoLinuxPath_LocalSteam));

const bool isUsingCustomParm = (Q_stricmp(neoPath, neoLinuxPath_LocalSteam) != 0);

Expand Down

0 comments on commit 79a8ce0

Please sign in to comment.