Phalcode / gamevault-backend

Backend for the self-hosted gaming platform for drm-free games
https://gamevau.lt
Other
221 stars 19 forks source link

How to get GOG game to work #330

Open MoSattler opened 1 day ago

MoSattler commented 1 day ago

Moin!

I purchased Anno 1602 from GOG and downloaded the DOWNLOAD OFFLINE BACKUP GAME INSTALLERS. This gave me the following files:

I’ve been struggling to add these files to GameVault. I keep getting the following error:

info:    ┏ Game marked as soft-deleted. +4ms  
info:    ┃ [1] {  
info:    ┃ [2]   context: 'FilesService',  
info:    ┃ [3]   game: { id: 21, path: '/files/Anno 1602 (v1.05) (1998).zip' },  
info:    ┃ [4]   reason: 'Game file not found in filesystem.',  
info:    ┃ [5]   timestamp: '2024-11-29T18:24:03.888Z'  
info:    ┗ [6] }  

Attempts to Fix:

1. Top-Level Zipping:

I moved the files to the root of the zip:

root@server:/mnt/user/media/games/Anno 1602# zip -r "Anno 1602 (v1.05) (1998).zip" \
  "setup_anno_1602_-_creation_of_a_new_world_1.05_(30704).exe" \
  "setup_anno_1602_-_creation_of_a_new_world_1.05_(30704)-1.bin"
  adding: setup_anno_1602_-_creation_of_a_new_world_1.05_(30704).exe (deflated 16%)
  adding: setup_anno_1602_-_creation_of_a_new_world_1.05_(30704)-1.bin (deflated 0%)

Result:

root@server:/mnt/user/media/games# unzip -l "Anno 1602 (v1.05) (1998).zip"
Archive:  Anno 1602 (v1.05) (1998).zip
  Length      Date    Time    Name
---------  ---------- -----   ----
   993248  11-29-2024 02:25   setup_anno_1602_-_creation_of_a_new_world_1.05_(30704).exe
703382056  11-29-2024 02:28   setup_anno_1602_-_creation_of_a_new_world_1.05_(30704)-1.bin
---------                     -------

2. Folder-Based Zipping:

I kept the files in a folder named Anno 1602 (v1.05) (1998) and zipped the entire folder:

root@server:/mnt/user/media/games# zip -r "Anno 1602 (v1.05) (1998).zip" "Anno 1602 (v1.05) (1998)"
  adding: Anno 1602 (v1.05) (1998)/ (stored 0%)
  adding: Anno 1602 (v1.05) (1998)/setup_anno_1602_-_creation_of_a_new_world_1.05_(30704)-1.bin (deflated 0%)
  adding: Anno 1602 (v1.05) (1998)/._setup_anno_1602_-_creation_of_a_new_world_1.05_(30704)-1.bin (deflated 92%)
  adding: Anno 1602 (v1.05) (1998)/setup_anno_1602_-_creation_of_a_new_world_1.05_(30704).exe (deflated 16%)
  adding: Anno 1602 (v1.05) (1998)/._setup_anno_1602_-_creation_of_a_new_world_1.05_(30704).exe (deflated 87%)

Result:

root@server:/mnt/user/media/games# unzip -l "Anno 1602 (v1.05) (1998).zip"
Archive:  Anno 1602 (v1.05) (1998).zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  11-29-2024 10:17   Anno 1602 (v1.05) (1998)/
703382056  11-29-2024 02:28   Anno 1602 (v1.05) (1998)/setup_anno_1602_-_creation_of_a_new_world_1.05_(30704)-1.bin
     4096  11-29-2024 02:30   Anno 1602 (v1.05) (1998)/._setup_anno_1602_-_creation_of_a_new_world_1.05_(30704)-1.bin
   993248  11-29-2024 02:25   Anno 1602 (v1.05) (1998)/setup_anno_1602_-_creation_of_a_new_world_1.05_(30704).exe
     4096  11-29-2024 02:30   Anno 1602 (v1.05) (1998)/._setup_anno_1602_-_creation_of_a_new_world_1.05_(30704).exe
---------                     -------

Both approaches led to the same error in GameVault.

How do I correctly zip these files for GameVault to recognize them?

MoSattler commented 1 day ago

Turns out I have the same problem for any game. Here a single file installation exe by GOG

info:    ┏ Game marked as soft-deleted. +55ms
info:    ┃ [1] {
info:    ┃ [2]   context: 'FilesService',
info:    ┃ [3]   game: { id: 25, path: '/files/Darkest Hour (v1.05.1) (2011).exe' },
info:    ┃ [4]   reason: 'Game file not found in filesystem.',
info:    ┃ [5]   timestamp: '2024-11-29T18:39:47.857Z'
info:    ┗ [6] }
Alfagun74 commented 1 day ago

Hi there!

All the mentioned methods should be working. Could you please double-check if the games are located where the Gamevault server expects them to be? It would be great if you could share your Docker Compose file, the ls outputs of your mounted folders, and a server log captured about 5 minutes after starting the server. That should help us figure out what's going on. 😊

MoSattler commented 1 day ago

Could you please double-check if the games are located where the Gamevault server expects them to be?

It seems the server is correctly locating the games during refresh, which explains the logs. I haven’t explicitly set any paths; it seems to find them automatically, and then soft deleting them. I fact one of the game showed up for a millisecond before disappearing again. Maybe it adds them, and then soft-deletes them.

Just to clarify, the server setup is fresh, and I don’t have any games added yet. Could it be related to the way it handles empty or newly indexed libraries?

info:    ┏ Game marked as soft-deleted. +4ms  
info:    ┃ [1] {  
info:    ┃ [2]   context: 'FilesService',  
info:    ┃ [3]   game: { id: 21, path: '/files/Anno 1602 (v1.05) (1998).zip' },  
info:    ┃ [4]   reason: 'Game file not found in filesystem.',  
info:    ┃ [5]   timestamp: '2024-11-29T18:24:03.888Z'  
info:    ┗ [6] }  

Logs

text  error  warn  system  array  login  

info:    ┃ [4]   timestamp: '2024-11-29T18:39:47.802Z'
info:    ┗ [5] }
info:    ┏ Game marked as soft-deleted. +55ms
info:    ┃ [1] {
info:    ┃ [2]   context: 'FilesService',
info:    ┃ [3]   game: { id: 25, path: '/files/Darkest Hour (v1.05.1) (2011).exe' },
info:    ┃ [4]   reason: 'Game file not found in filesystem.',
info:    ┃ [5]   timestamp: '2024-11-29T18:39:47.857Z'
info:    ┗ [6] }
info:    ┏ Finished Game Integrity Check. +0ms
info:    ┃ [1] {
info:    ┃ [2]   context: 'FilesService',
info:    ┃ [3]   count: 1,
info:    ┃ [4]   timestamp: '2024-11-29T18:39:47.857Z'
info:    ┗ [5] }
info:    ┏ mosattler @ ::ffff:100.99.14.39 - GET /api/games?search=&sortBy=sort_title:ASC&limit=50 -> 200 (49.269 ms) - - bytes in - 314 bytes out - via GameVault/1.13.1.0
 +4s
info:    ┗ [1] { context: 'HTTP Request', timestamp: '2024-11-29T18:39:52.101Z' }
info:    ┏ mosattler @ ::ffff:100.99.14.39 - GET /api/games?search=&sortBy=sort_title:ASC&limit=50 -> 200 (51.912 ms) - - bytes in - 314 bytes out - via GameVault/1.13.1.0
 +2s
info:    ┗ [1] { context: 'HTTP Request', timestamp: '2024-11-29T18:39:54.537Z' }
info:    ┏ mosattler @ ::ffff:100.99.14.39 - GET /api/games?search=&sortBy=sort_title:ASC&limit=50 -> 200 (60.915 ms) - - bytes in - 314 bytes out - via GameVault/1.13.1.0
 +25s
info:    ┗ [1] { context: 'HTTP Request', timestamp: '2024-11-29T18:40:19.167Z' }
info:    ┏ mosattler @ ::ffff:100.99.14.39 - GET /api/games?search=&sortBy=sort_title:ASC&limit=50 -> 200 (61.221 ms) - - bytes in - 314 bytes out - via GameVault/1.13.1.0
 +4m
info:    ┗ [1] { context: 'HTTP Request', timestamp: '2024-11-29T18:44:30.726Z' }
info:    ┏ mosattler @ ::ffff:100.99.14.39 - GET /api/config/news -> 200 (52.933 ms) - - bytes in - - bytes out - via GameVault/1.13.1.0
 +4m
info:    ┗ [1] { context: 'HTTP Request', timestamp: '2024-11-29T18:48:04.073Z' }
info:    ┏ Indexing game(s). +12m
info:    ┃ [1] {
info:    ┃ [2]   context: 'FilesService',
info:    ┃ [3]   jobs: 0,
info:    ┃ [4]   timestamp: '2024-11-29T19:00:00.017Z'
info:    ┗ [5] }
error:   ┏ Error reading files. +8ms
error:   ┃ [ 1] []
error:   ┃ [ 2] {
error:   ┃ [ 3]   context: 'FilesService',
error:   ┃ [ 4]   error: Error: EACCES: permission denied, scandir '/files/Into the Breach/IntoTheBreach_1_2_76_Linux'
error:   ┃ [ 5]       at async readdirRecursive (node:internal/fs/promises:896:13)
error:   ┃ [ 6]       at async FilesService.readAllFiles (/app/src/modules/games/files.service.ts:605:9)
error:   ┃ [ 7]       at async FilesService.index (/app/src/modules/games/files.service.ts:113:48)
error:   ┃ [ 8]       at async CronJob.<anonymous> (/app/node_modules/.pnpm/@nestjs+schedule@4.1.1_@nestjs+common@10.4.6_class-transformer@0.5.1_class-validator@0.14.1_r_vq7ljdie4j2fbguhhtzbswecae/node_modules/@nestjs/schedule/dist/schedule.explorer.js:119:17) {
error:   ┃ [ 9]     code: 'EACCES',
error:   ┃ [10]     errno: -13,
error:   ┃ [11]     path: '/files/Into the Breach/IntoTheBreach_1_2_76_Linux',
error:   ┃ [12]     syscall: 'scandir'
error:   ┃ [13]   },
error:   ┃ [14]   timestamp: '2024-11-29T19:00:00.025Z'
error:   ┗ [15] }
info:    ┏ Calculated difference of all media paths and used media paths. +0ms
info:    ┃ [1] {
info:    ┃ [2]   all_count: 0,
info:    ┃ [3]   context: 'MediaGarbageCollectionService',
info:    ┃ [4]   delta: 0,
info:    ┃ [5]   timestamp: '2024-11-29T19:00:00.026Z',
info:    ┃ [6]   used_count: 0
info:    ┗ [7] }
info:    ┏ Indexing game(s). +60m
info:    ┃ [1] {
info:    ┃ [2]   context: 'FilesService',
info:    ┃ [3]   jobs: 0,
info:    ┃ [4]   timestamp: '2024-11-29T20:00:00.005Z'
info:    ┗ [5] }
error:   ┏ Error reading files. +13ms
error:   ┃ [ 1] []
error:   ┃ [ 2] {
error:   ┃ [ 3]   context: 'FilesService',
error:   ┃ [ 4]   error: Error: EACCES: permission denied, scandir '/files/Into the Breach/IntoTheBreach_1_2_76_Linux'
error:   ┃ [ 5]       at async readdirRecursive (node:internal/fs/promises:896:13)
error:   ┃ [ 6]       at async FilesService.readAllFiles (/app/src/modules/games/files.service.ts:605:9)
error:   ┃ [ 7]       at async FilesService.index (/app/src/modules/games/files.service.ts:113:48)
error:   ┃ [ 8]       at async CronJob.<anonymous> (/app/node_modules/.pnpm/@nestjs+schedule@4.1.1_@nestjs+common@10.4.6_class-transformer@0.5.1_class-validator@0.14.1_r_vq7ljdie4j2fbguhhtzbswecae/node_modules/@nestjs/schedule/dist/schedule.explorer.js:119:17) {
error:   ┃ [ 9]     code: 'EACCES',
error:   ┃ [10]     errno: -13,
error:   ┃ [11]     path: '/files/Into the Breach/IntoTheBreach_1_2_76_Linux',
error:   ┃ [12]     syscall: 'scandir'
error:   ┃ [13]   },
error:   ┃ [14]   timestamp: '2024-11-29T20:00:00.018Z'
error:   ┗ [15] }
info:    ┏ Calculated difference of all media paths and used media paths. +0ms
info:    ┃ [1] {
info:    ┃ [2]   all_count: 0,
info:    ┃ [3]   context: 'MediaGarbageCollectionService',
info:    ┃ [4]   delta: 0,
info:    ┃ [5]   timestamp: '2024-11-29T20:00:00.019Z',
info:    ┃ [6]   used_count: 0
info:    ┗ [7] }

ls

root@server:/mnt/user/media/games# ls
Anno\ 1602\ (v1.05)\ (1998)/     Darkest\ Hour/                         FTL/                Mindustry/
Anno\ 1602\ (v1.05)\ (1998).zip  Darkest\ Hour\ (v1.05.1)\ (2011).exe*  Into\ the\ Breach/
MoSattler commented 1 day ago

compose file

services:
  tailscale:
    container_name: gamevault-tailscale
    image: tailscale/tailscale:stable
    restart: unless-stopped
    volumes:
      - /mnt/user/appdata/gamevault/tailscale:/state
      - /mnt/user/appdata/gamevault/tailscale/config:/config
    environment:
      TS_SERVE_CONFIG: /config/config.json
      TS_STATE_DIR: /state
      TS_HOSTNAME: gamevault

  gamevault-backend:
    image: phalcode/gamevault-backend:latest
    restart: unless-stopped
    environment:
      DB_HOST: db
      DB_USERNAME: reawake4083
      DB_PASSWORD: xxxx
    volumes:
      # Mount the folder where your games are
      - /mnt/user/media/games:/files
      - /mnt/user/appdata/gamevault/gamevault/media:/media
    ports:
      - 8080:8080/tcp

  db:
    image: postgres:16
    restart: unless-stopped
    environment:
      POSTGRES_USER: reawake4083
      POSTGRES_PASSWORD: xxxx
      POSTGRES_DB: gamevault
    volumes:
      - /mnt/user/appdata/gamevault/gamevault/data:/var/lib/postgresql/data
Alfagun74 commented 1 day ago

I can see some permission errors regarding this folder:

/files/Into the Breach/IntoTheBreach_1_2_76_Linux

Can you double check the gamevault user default (1000:1000) has access to all folders and files in his volume? Otherwise permission errors may crash the indexer.

for instance using: sudo chown 1000:1000 -R /mnt/user/media/games


P.S.: Yeah the more i look into the code the more it looks like that is exactly youre issue.

The File-Reader sees a permissions error and returns an empty list: https://github.com/Phalcode/gamevault-backend/blob/db6df11ed491bb55368685c839a3c6fac2648e09/src/modules/games/files.service.ts#L624

Anyway, fix the permissions and it should work for you. Thanks for reporting anyways! https://github.com/Phalcode/gamevault-backend/issues/305 has the same issue, will look into fixing this soon.