tkashkin / GameHub

All your games in one place
https://tkashkin.github.io/projects/gamehub
GNU General Public License v3.0
2.22k stars 129 forks source link

DOSBox call from wrong directory #278

Open hlechner opened 5 years ago

hlechner commented 5 years ago
Expected behavior

The dir to launch DOSBox should be the Installation Directory or the place of the primary .conf file.

Actual behavior

However I find out if there is a folder called DOSBOX into the Installation Directory it will use this folder instead.

It uses: dir: '/home/hlechner/.wine/drive_c/Program Files (x86)/GOG.com/Little Big Adventure 2/DOSBOX' But should be: dir: '/home/hlechner/.wine/drive_c/Program Files (x86)/GOG.com/Little Big Adventure 2'

This folder is used only to store the windows binary of DOSBox, the .conf file is not on it.

To test I've renamed the directory from DOSBOX to DOSBOX-old to test, then the GameHub do no try to use this folder anymore as dir.

Steps to reproduce
Version and environment
Version: 0.14.1-8865f62-makepkg
Branch:  makepkg
Commit:  8865f62 (8865f62cc982a35dfe70e70f4b50996413a92f06)
Distro:  NAME=Arch Linux
DE:      Yaru:ubuntu:GNOME
tkashkin commented 5 years ago

This is expected for GOG Windows games. They have Windows version of DOSBox bundled in $install_dir/DOSBOX directory and configs in $install_dir. Working directory is DOSBOX and configs are mounting .. as C: drive.

neuromancer commented 5 years ago

As @tkashkin said, this is working as expected to properly run GOG DOSBox games. Is there any game (e.g. Little Big Adventure 2) failing to run because of this?

hlechner commented 5 years ago

I have tested only Little Big Adventure 2 as GOG game.

But it does fail to start. the reason is because it do not try to mount .. but . instead:

[autoexec]
# Lines in this section will be run at startup.
@echo off
mount C .
imgmount d "LBA2.DAT" -t iso
c:
cls
lba2.EXE
exit
neuromancer commented 5 years ago

I just installed "Little Big Adventure 2" from GOG and this dosboxLBA2_single.conf file I got:

...
[autoexec]
# Lines in this section will be run at startup.
@echo off
mount C ".."
imgmount d "..\LBA2.DAT" -t iso
c:
goto launcher
...

It won't work out of the box without fixing the path ("..\LBA2.DAT" -> "../LBA2.DAT"), but I don't think we should change anything here.

hlechner commented 5 years ago

Strange, the .conf is different from mine. The filename is also different, here mine: dosboxLBA2.conf

Let's figure out what is causing it.

I'm using this installer:

$ md5sum setup_lba2.exe 
cb7cd7056cbb8bf7164548185795667f  setup_lba2.exe

I've installed it using wine-4.11 (vanilla), the Installation directory is .wine/drive_c/Program Files (x86)/GOG.com/Little Big Adventure 2

Are you using something different?

neuromancer commented 5 years ago

Are you using GameHub to install the game from GOG? This is the installer that was downloaded:

$ md5sum setup_little_big_adventure_2_1.0_\(28192\).exe
80b95bb8faa2353284b321748021da16  setup_little_big_adventure_2_1.0_(28192).exe
hlechner commented 5 years ago

I don't have this game on my GOG account, but I found this executable on my backup files, probably an old-version of it.

I tried to install by adding the installer on GameHub (to install using proton) but wasn't working so I decided to install wine and run it through the console, after installed it I just added to the GameHub library and activate the DOSBox compatibly layer.

Seems this difference of approach from our GOG versions seems to trigger the issue, If remove the feature of change the dir your updated version stop to work, if enable mine outdated version stop to work.

Maybe I need to get your version and see the differences between files comparing from my version, if I can find a easy way to implement an if to trigger (or not) the dir change.

neuromancer commented 5 years ago

My opinion is that GameHub works as expected in this case, since the code was not designed/tested to deal with old versions of the GOG installers. If you want to use version, just delete the DOSBox directory and it should run as expected. However, a little of documentation about this in the wiki could be useful, in case another user deals with the same use case.

hlechner commented 5 years ago

From what I searched the .conf files from your version are placed inside the DOSBOX folder: Little Big Adventure 2/DOSBOX:

dosboxLBA2.conf
dosboxLBA2_settings.conf
dosboxLBA2_single.conf

However it's not my case, there is no .conf inside DOSBOX.

If is that the case, it's very simple to implement: you just need a .conf file inside the DOSBOX folder otherwise it will not change the dir to DOSBOX folder.

@neuromancer could you confirm this? do you have any GOG DOSBox game that doesn't have a .conf inside the DOSBOX folder?

neuromancer commented 5 years ago

From what I searched the .conf files from your version are placed inside the DOSBOX folder: Little Big Adventure 2/DOSBOX

Nop, all the .conf files from setup_little_big_adventure_2_1.0_(28192).exe are outside DOSBOX. That folder contains this:

$ ls DOSBOX
Documentation
DOSBox 0.74-2 Manual.txt
dosbox-0.74-2.1.tar.gz
DOSBox.exe
GOGDOSConfig.exe
SDL.dll
SDL_net.dll
Video Codec

@neuromancer could you confirm this? do you have any GOG DOSBox game that doesn't have a .conf inside the DOSBOX folder?

I haven't see any GOG DOSBox game with a .conf inside the DOSBOX folder. In fact, even some DOS games from other sources like HumbleBundle or Steam follow the same approach.

hlechner commented 5 years ago

I have updated the wiki to reflect the new status of DOSBox support, including the information of how handle the old installers.

I'll try to download as many old/new GOG installers as I can, so I can check if there is a simple way to do this check, otherwise I just close this issue with the information that I got.

Note to myself: check if all new installers have _single.conf file and no older installer have it.

hlechner commented 5 years ago

I have downloaded 18 games :

========= [no _single.conf][uses "."] ===============
Crusader No Regret
Little big adventure 1
Little big adventure 2
Simcity 2000 special edition
Tombraider 1+2+3
Tyrian 2000
The zork anthology
======== [yes _single.conf][uses ".."] ==============
Albion
Alone in the dark 1+2+3
Disney alladin
Disney the lion king
Rayman forever
Star wars - dark force
Syndicate wars
The ultimate DOOM
Ultima 1+2+3+4+5+6
Wolfenstein 3D and Spear of Destiny
Worms united

My methodology was to innoextract the setup file (.exe) game by game and check the .conf files of those games.

Malbeth81 commented 4 years ago

Also having an issue launching The Witcher 3 after having had to install it manually (download wouldn't work through GameHub).

I had to make a .bat file to cd into the bin/x64 before executing witcher3.exe, but it leave a command prompt open while the game runs.

I think this and all other similar issues could be easily fixed by simply adding a "working dir" settings in the game's properties dialog so we can specify from which folder the game should be executed.

Malbeth81 commented 4 years ago

If you don't want to add an extra setting for the working dir, simply allowing us to change the install_path would also fix all the problems, after opening the database in SQLite Browser and changing it for the Witcher 3 it launched correctly without the .bat file.

Lucki commented 4 years ago

I had to make a .bat file to cd into the bin/x64 before executing witcher3.exe

I also noticed this while I couldn't get a game to run with gamehub and it worked flawless with a manual wine call. Turned out the game has to be started in the folder of the executable which gamehub doesn't let me set.

Although this seems like another issue as the one discussed here before…

tkashkin commented 4 years ago

@Malbeth81 it's possible to set working directory in current dev version (since 52f4a13).

Lucki commented 4 years ago

@tkashkin Sadly that option gets ignored for me:

#!/bin/bash
GH_EXECUTABLE="$1"
GH_INSTALL_DIR="$2"
GH_GAME_ID="$3"
GH_GAME_ID_FULL="$4"
GH_GAME_NAME="$5"
GH_GAME_NAME_ESCAPED="$6"

echo GH_EXECUTABLE=$GH_EXECUTABLE
echo GH_INSTALL_DIR=$GH_INSTALL_DIR
echo GH_GAME_ID=$GH_GAME_ID
echo GH_GAME_ID_FULL=$GH_GAME_ID_FULL
echo GH_GAME_NAME=$GH_GAME_NAME
echo GH_GAME_NAME_ESCAPED=$GH_GAME_NAME_ESCAPED

===>

GH_EXECUTABLE=/mnt/gamehub/gamehub/other/Grand Theft Auto San Andreas/gta_sa.exe
GH_INSTALL_DIR=287222e2701eed4f97c2ff9acb0eb539
GH_GAME_ID=user:287222e2701eed4f97c2ff9acb0eb539
GH_GAME_ID_FULL=Grand Theft Auto: San Andreas
GH_GAME_NAME=Grand_Theft_Auto_San_Andreas
GH_GAME_NAME_ESCAPED=

And it's not possible to set the folder to an overlayFS-one, the input field gets cleared.

I guess it's the middle option to set the working dir: ![grafik](https://user-images.githubusercontent.com/1408843/77774688-c51b9a00-704b-11ea-836e-8b2931ac4a6b.png)
tkashkin commented 4 years ago

@Lucki it seems I forgot to actually pass install_dir to custom scripts.

Anyway, custom scripts should be launched in work_dir (which is install_dir by default). Try pwd to check this.

I guess it's the middle option to set the working dir

Yes.

Lucki commented 4 years ago

custom scripts should be launched in work_dir, try pwd to check this.

You're right. There has to be another issue then here, will diagnose a further. => #358 and #359 combined looked like it wasn't functional.