bvschaik / julius

An open source re-implementation of Caesar III
GNU Affero General Public License v3.0
2.79k stars 311 forks source link

KDE directory picker dialog for game data not picking #711

Closed gryffus closed 8 months ago

gryffus commented 8 months ago

Operating System: openSUSE Tumbleweed 20231218 kdialog Version 23.08.4 KDE Plasma Version: 5.27.10 KDE Frameworks Version: 5.113.0 Qt Version: 5.15.11 Graphics Platform: X11

Julius seems to create following file:

.local/share/bvschaik/julius/data_dir.txt

with location to current game data directory.

I have done a simple test:

~> pwd
/home/gryffus

~> echo "/home/gryffus/.julius-data/" > ~/.local/share/bvschaik/julius/data_dir.txt

~> cat ~/.local/share/bvschaik/julius/data_dir.txt
/home/gryffus/.julius-data/

~> ls /home/gryffus/.julius-data/ | grep -m 2 c3 
c3.emp
c3.eng

~> ~/julius-1.7.0.142-082866c6-linux.AppImage 
INFO: Julius version 1.7.0.142-082866c6
INFO: Initializing SDL
INFO: SDL initialized
INFO: Loading game from working directory
ERROR: 'c3.eng' or 'c3_mm.eng' files not found or too large.
INFO: Loading game from base path /tmp/.mount_julius3lrADg/usr/bin/
ERROR: 'c3.eng' or 'c3_mm.eng' files not found or too large.
INFO: Loading game from user pref /home/gryffus/.julius-data/
kf.kio.core: UDSEntry for '.' not found, creating a default one. Please fix the "kdialog" KIO worker.

<here it opens KDE file dialog, but when you direct it to the data directory and hit "Open",
 it does not do anything - the dialog stays open>

INFO: Exiting: game pre-init failed

If I put the data files to ~/.julius/ directory, or cd there, it works correctly:

~> cd .julius-data/

~/.julius-data> ~/julius-1.7.0.142-082866c6-linux.AppImage 2>&1 | head -n 6
INFO: Julius version 1.7.0.142-082866c6
INFO: Initializing SDL
INFO: SDL initialized
INFO: Loading game from working directory
INFO: Config key  gameplay_fix_immigration  1
INFO: Config key  gameplay_fix_100y_ghosts  1

Both distro binaries and AppImage are behaving the same.

bvschaik commented 8 months ago

Try removing the newline in the data_dir.txt file. This file was not meant to be edited by anything other than the game itself, so there's not much error handling going on there.

gryffus commented 8 months ago

That helped. Game successfully starts from any directory now :) Although with somewhat confusing output:

INFO: Julius version 1.7.0.142-082866c6
INFO: Initializing SDL
INFO: SDL initialized
INFO: Loading game from working directory
INFO: No key found on layout for  [
INFO: No key found on layout for  ]
ERROR: 'c3.eng' or 'c3_mm.eng' files not found or too large.
INFO: Loading game from base path /tmp/.mount_juliusWHymD5/usr/bin/
INFO: No key found on layout for  [
INFO: No key found on layout for  ]
ERROR: 'c3.eng' or 'c3_mm.eng' files not found or too large.
INFO: Loading game from user pref /home/gryffus/.julius/
INFO: Config key  gameplay_fix_immigration  1

However there is still the issue with non-working KDE file picker dialog. This can be reproduced on clean install, when "~/.local/share/bvschaik/julius/data_dir.txt" file does not yet exist.

I will rename the ticket to better describe the issue.

Thanks a lot for quick reply!

crudelios commented 8 months ago

Note that it's not a file picker, but a directory picker.

It's working here on my Steam Deck's desktop mode KDE, so it may actually be an issue with your distro!

Edit: Tested using the appimage build and it's working fine for me.

gryffus commented 8 months ago

I have updated KDE, Qt and kdialog versions in the desription.

crudelios commented 8 months ago

I still don't think this is a Julius bug, as the dialog works fine everywhere else and it's a system dialog.

Which distro are you using?

gryffus commented 8 months ago

Yep, I just got confirmed it's a kdialog 23.08.4 bug. Probably related to https://invent.kde.org/utilities/kdialog/-/merge_requests/17 .

Sorry for confusion, closing.