0neGal / viper

Launcher+Updater for TF|2 Northstar
https://0negal.github.io/viper
GNU General Public License v3.0
152 stars 21 forks source link

bug: Viper not auto-detecting Titanfall2 install when Steam is installed via Flatpak #95

Closed GeckoEidechse closed 2 years ago

GeckoEidechse commented 2 years ago

Describe the bug If Steam is installed via Flatpak, Viper is unable to detect the Titanfall2 install location.

To Reproduce Steps to reproduce the behavior:

  1. Install Steam as Flatpak via Flathub
  2. Install Titanfall2 in Steam
  3. Download an run the Viper AppImage
  4. Viper fails to detect install location of Titanfall2

Expected behavior Viper should be able to auto-detect the Titanfall2 install location even if Steam is installed as a Flatpak

Screenshots

Version: v1.2.5

Additional Info I wanted to check whether the failure to auto-detect install location as part of #94 also affects versions of Linux that aren't SteamOS. So I tried it on another Linux machine of mine, where it promptly failed. I realised however that this was due to the fact that Steam was installed as a Flatpak which probably wasn't anticipated when auto-detecting install path on Linux was added to Viper in #53.

For the Flatpak version of Steam, the default install location of Titanfall2 is ~/.var/app/com.valvesoftware.Steam/.steam/steam/steamapps/common/Titanfall2

Content of ~/.var/app/com.valvesoftware.Steam/.steam/steam/steamapps/libraryfolders.vdf which contains the appid for Titanfall2 (1237970):

"libraryfolders"
{
    "contentstatsid"        "1743050728782069232"
    "0"
    {
        "path"      "/home/asus/.var/app/com.valvesoftware.Steam/.local/share/Steam"
        "label"     ""
        "contentid"     "1743050728782069232"
        "totalsize"     "0"
        "update_clean_bytes_tally"      "0"
        "time_last_update_corruption"       "0"
        "apps"
        {
            "228980"        "135939663"
            "1237970"       "68431323338"
            "1887720"       "1112259872"
        }
    }
}

Also I noticed that ~/.var/app/com.valvesoftware.Steam/.steam/steam links to ~/.var/app/com.valvesoftware.Steam/.local/share/Steam so I guess the two paths can be used interchangeably?

0neGal commented 2 years ago

98 should now fix this, maybe? However I don't think it'll work if non-Flatpak Steam is also installed, so when testing, you should probably temporarily rename your normal libraryfolders.vdf file, or something.

GeckoEidechse commented 2 years ago

Hmm, so unrelated to viper, it seems ~/.var/app/com.valvesoftware.Steam/.steam/steam link to ~/.var/app/com.valvesoftware.Steam/.local/share/Steam is broken on this machine... Not sure if that's a single issue on my side but it might make sense to check both

GeckoEidechse commented 2 years ago

And libraryfolders.vdf is also different to what I posted earlier from a different machine (both are Flatpak install)

"libraryfolders"
{
    "contentstatsid"        "6743519362182655292"
    "0"
    {
        "path"      "/home/gecko/.local/share/Steam"
        "label"     ""
        "contentid"     "6743519362182655292"
        "totalsize"     "0"
        "update_clean_bytes_tally"      "0"
        "time_last_update_corruption"       "0"
        "apps"
        {
            "1012560"       "1577655712"
            "1113280"       "910331459"
        }
    }
}
GeckoEidechse commented 2 years ago

That being said, I sadly cannot test whether Flatpak Steam install works atm as I don't have access to the machine where Titanfall2+Steam is installed via Flatpak. (My laptop doesn't have enough storage to even start installing Titanfall2 and simply editing libraryfolders.vdf didn't seem to have been enough :c)

0neGal commented 2 years ago

Hmm, so unrelated to viper, it seems ~/.var/app/com.valvesoftware.Steam/.steam/steam link to ~/.var/app/com.valvesoftware.Steam/.local/share/Steam is broken on this machine... Not sure if that's a single issue on my side but it might make sense to check both

That would be rather tedious to check both, I'll just implement a way for it to check all of them, aka, if normal Steam libraryfolders.vdf exists but Titanfall isn't found in it it'll check the next one.

That being said, I sadly cannot test whether Flatpak Steam install works atm as I don't have access to the machine where Titanfall2+Steam is installed via Flatpak.

We actually only check for the gamepath to have a Titanfall2.exe file in it, the contents of it doesn't matter.

... and simply editing libraryfolders.vdf didn't seem to have been enough :c

We also don't use the actual app ID's, we instead search through all the libraries check if steamapps/common/Titanfall2 exists in the library folder, and then validate it like mentioned before with the .exe existing, i.e just make the folder structure and that file, and it should work.


I'll have a further look at it all tomorrow, hopefully fixing it, and getting a release out before the master server gets back up...

0neGal commented 2 years ago

I pushed a commit which should ideally allow it to search multiple VDF files and return it properly and everything, I did some testing and it seems to work just fine, but if you could confirm it that'd be lovely. :)

It's also very simple to add more file paths/VDF files if need be in the future... As it's just an array per platform... There's also a few debug logs to verify it works! Keep in mind they run no matter what, you can even just run ./Viper-1.2.5.AppImage --help and it'll still output it...

GeckoEidechse commented 2 years ago

Aight so I tried building from source using the Docker image like last time but it seems like npm wants to stop me every step on the way. Being too old versions of npm, peer dependency issues or electron-builder failures. Maybe you could just provide me with an existing AppImage to test? :3

Output of the stuff I tried ``` $ docker run --rm -ti --env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS_TAG|TRAVIS|TRAVIS_REPO_|TRAVIS_BUILD_|TRAVIS_BRANCH|TRAVIS_PULL_REQUEST_|APPVEYOR_|CSC_|GH_|GITHUB_|BT_|AWS_|STRIP|BUILD_') --env ELECTRON_CACHE="/root/.cache/electron" --env ELECTRON_BUILDER_CACHE="/root/.cache/electron-builder" -v ${PWD}:/project -v ${PWD##*/}-node-modules:/project/node_modules -v ~/.cache/electron:/root/.cache/electron -v ~/.cache/electron-builder:/root/.cache/electron-builder electronuserland/builder:wine root@2e313db1f3f5:/project# npm --version 6.14.13 root@2e313db1f3f5:/project# npm i npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it! npm WARN deprecated dmg-license@1.0.11: Disk image license agreements are deprecated by Apple and will probably be removed in a future macOS release. Discussion at: https://github.com/argv-minus-one/dmg-license/issues/11 npm ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for dmg-license@1.0.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm ERR! notsup Valid OS: darwin npm ERR! notsup Valid Arch: any npm ERR! notsup Actual OS: linux npm ERR! notsup Actual Arch: x64 npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2022-04-01T16_55_15_771Z-debug.log root@2e313db1f3f5:/project# npm install npm -g /usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js + npm@8.6.0 added 58 packages from 18 contributors, removed 293 packages and updated 142 packages in 4.095s root@2e313db1f3f5:/project# npm --version 8.6.0 root@2e313db1f3f5:/project# npm i npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: marked-man@0.7.0 npm ERR! Found: marked@4.0.10 npm ERR! node_modules/marked npm ERR! marked@"^4.0.10" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer marked@"^0.7.0" from marked-man@0.7.0 npm ERR! node_modules/marked-man npm ERR! marked-man@"^0.7.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: marked@0.7.0 npm ERR! node_modules/marked npm ERR! peer marked@"^0.7.0" from marked-man@0.7.0 npm ERR! node_modules/marked-man npm ERR! marked-man@"^0.7.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See /root/.npm/eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2022-04-01T16_55_41_588Z-debug-0.log root@2e313db1f3f5:/project# npm i --force npm WARN using --force Recommended protections disabled. npm WARN ERESOLVE overriding peer dependency npm WARN While resolving: marked-man@0.7.0 npm WARN Found: marked@4.0.10 npm WARN node_modules/marked npm WARN marked@"^4.0.10" from the root project npm WARN npm WARN Could not resolve dependency: npm WARN peer marked@"^0.7.0" from marked-man@0.7.0 npm WARN node_modules/marked-man npm WARN marked-man@"^0.7.0" from the root project npm WARN npm WARN Conflicting peer dependency: marked@0.7.0 npm WARN node_modules/marked npm WARN peer marked@"^0.7.0" from marked-man@0.7.0 npm WARN node_modules/marked-man npm WARN marked-man@"^0.7.0" from the root project added 304 packages, and audited 305 packages in 19s 25 packages are looking for funding run `npm fund` for details 3 vulnerabilities (1 low, 1 high, 1 critical) To address all issues, run: npm audit fix Run `npm audit` for details. root@2e313db1f3f5:/project# npx electron-builder --linux appimage • electron-builder version=22.14.5 os=5.4.0-107-generic • loaded configuration file=package.json ("build" field) • writing effective config file=dist/builder-effective-config.yaml • packaging platform=linux arch=x64 electron=16.0.5 appOutDir=dist/linux-unpacked ⨯ stat /root/.cache/electron/electron-v16.0.5-linux-x64.zip: permission denied github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).Download /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:161 github.com/develar/app-builder/pkg/electron.downloadElectron.func1.1 /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:73 github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func2 /Volumes/data/Documents/app-builder/pkg/util/async.go:68 runtime.goexit /usr/local/Cellar/go/1.16.5/libexec/src/runtime/asm_amd64.s:1371 ⨯ /project/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE failedTask=build stackTrace=Error: /project/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE at ChildProcess. (/project/node_modules/builder-util/src/util.ts:250:14) at Object.onceWrapper (events.js:483:26) at ChildProcess.emit (events.js:376:20) at maybeClose (internal/child_process.js:1055:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) ┌───────────────────────────────────────────────────┐ │ electron-builder update check failed │ │ Try running with sudo or get access │ │ to the local update config store via │ │ sudo chown -R $USER:$(id -gn $USER) /root/.config │ └───────────────────────────────────────────────────┘ root@2e313db1f3f5:/project# ```
0neGal commented 2 years ago

Maybe you could just provide me with an existing AppImage to test? :3

Try this link :3

GeckoEidechse commented 2 years ago

Worked. Titanfall2 Steam Flatpak install successfully detected :D (I made sure to delete viper.json before running)

0neGal commented 2 years ago

Lovely I'll be merging it then! :)

GeckoEidechse commented 2 years ago

Confirmed working ootb in 1.3.1 ^^