Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dosbox enhancements #51

Closed
neuromancer opened this issue Aug 26, 2018 · 15 comments
Closed

Dosbox enhancements #51

neuromancer opened this issue Aug 26, 2018 · 15 comments

Comments

@neuromancer
Copy link
Contributor

A lot of GOG games are using dosbox. I wonder if we could have some special options to handle them, for instance to replace the bundled dosbox executable with the system one. This feature, combined with #33, will enable the automatic port of some games arbitrarily available for some platforms.

@tkashkin
Copy link
Owner

Probably it's possible, assuming dosbox configs are in consistent location. It may not work if Windows game's dosbox have some game-specific tweaks, but it probably should be somewhat compatible.

@neuromancer
Copy link
Contributor Author

AFAIK, some dosbox configs use Windows only paths to run (for instance using \ instead of / or with case insensitive filenames). That's the biggest issue for 'automatic porting'.

@tkashkin tkashkin added this to the Non-native games support milestone Aug 26, 2018
tkashkin added a commit that referenced this issue Sep 17, 2018
Allow to force compat even for games which do support Linux (#51, #52, 
#71)
@tkashkin
Copy link
Owner

There's now DOSBox CompatTool.
It should be available if dosbox is installed.

It supports loading additional configs like this for forcing windowed mode.

CompatTools now can be forced even for native games.

Btw I'm wondering if it's still appropriate to call it "compat tools", since there's "custom script" tool. 🤔

@neuromancer
Copy link
Contributor Author

There's now DOSBox CompatTool.
It should be available if dosbox is installed.

Great! I tested with some games. It works, but it requires to a few adjustments in the dosbox confs (this is expected, so we don't have to worry). Allowing to edit the .conf files could be a good idea.

There is one thing that is annoying: some GOG games define more than two .conf files to configure games or run then in multiplayer (having _client.conf and _server.conf files). GameHub combine all the .conf files while it should only select two of them. It's not completely straightforward how to do it: it must select the GAMEID.conf and GAMEID_single.conf files. Unfortunately, the GAMEID for every game is not documented: for instance, some games like Magic Carpet use "MC" as GAMEID.

Also, the select executable option makes no sense for Dosbox.

Btw I'm wondering if it's still appropriate to call it "compat tools", since there's "custom script" tool.

Maybe dosbox and scummvm are "port tools"?

@neuromancer
Copy link
Contributor Author

Also, I'm not sure how GameHub should deal with some special GOG games that include several titles inside (like Dangerous Dave pack)

@tkashkin
Copy link
Owner

tkashkin commented Sep 18, 2018

I don't know, I don't have too many DOS games in GOG library.
It would help if you provide files structure for some games you have.

Example: Akalabeth: World of Doom (idk what that is, it's just easy to test as it's on top of games list 🙂)


Akalabeth: World of Doom (Linux):
  • dosboxAkalabeth.conf
  • dosboxAkalabeth_single.conf - uses mount C "data"
  • data - game root
  • dosbox/dosbox{,_i686,_x86_64} - dosbox binary
  • . - working dir
Akalabeth: World of Doom (Windows):
  • dosboxAkalabeth.conf
  • dosboxAkalabeth_single.conf - uses mount C ".."
  • . - game root
  • DOSBOX/DOSBox.exe - dosbox binary
  • DOSBOX - working dir

@neuromancer
Copy link
Contributor Author

Some GOG games using dosbox:
GOG.txt

One HumbleBundle game using dosbox (installing using wine, because innoextract was failing):
Humble.txt

Any directory named 'confs' was created by name to keep the original .conf files and let GameHub launch the games.

@tkashkin
Copy link
Owner

Post contents of goggame-<id>.info file of any game with many (>2) DOSBox configs.

@tkashkin
Copy link
Owner

So Dangerous Dave pack you've mentioned is just multiple games in subdirectories (unlike other games with multiple configs).
I don't really know how to handle such cases.

I also don't see goggame-<id>.info file.

Was it installed using the most recent installer? I've thought all GOG installers should be updated and have similar structure (especially after Galaxy launch). Is it even working in Galaxy?

@neuromancer
Copy link
Contributor Author

@tkashkin
Copy link
Owner

tkashkin commented Sep 18, 2018

So it seems it doesn't run DOSBox for multiplayer directly and uses GOGDOSConfig instead (possibly MP in this game won't even work if DOSBox will be launched directly):

"playTasks": [
	{
		"isPrimary" : true,
		"type"      : "FileTask",
		"path"      : "DOSBOX\\dosbox.exe",
		"workingDir" : "DOSBOX",
		"arguments"  : "-conf \"..\\dosboxMC.conf\" -conf \"..\\dosboxMC_single.conf\" -noconsole -c \"exit\""
	},
	{
		"name" : "Graphic Mode Setup",
		"type" : "FileTask",
		"path" : "DOSBOX\\GOGDOSConfig.exe",
		"workingDir" : "DOSBOX",
		"arguments"  : "1207658935"
	},
	{
		"name" : "Run Multiplayer Game",
		"type" : "FileTask",
		"path" : "DOSBOX\\GOGDOSConfig.exe",
		"workingDir" : "DOSBOX",
		"arguments"  : "1207658935 NET"
	},
	{
		"name" : "Reset Game Language",
		"type" : "FileTask",
		"path" : "reset_language.bat",
		"workingDir" : ""
	}
]

There is one thing that is annoying: some GOG games define more than two .conf files

I have thought about a few solutions for this:

  • Try to detect dosbox<game>.conf and dosbox<game>_single.conf and ignore other confs
  • Just show a checklist with all found confs (seems not very user-friendly)
  • Try to get required confs from goggame-<id>.info if exists (DOSBox only, ignore other tasks)
  • Try to parse goggame-<id>.info for all tools (including Wine/Proton) if exists and show a list with tasks (or run default task automatically like Galaxy does, but display list somewhere)

@neuromancer
Copy link
Contributor Author

Try to detect dosbox.conf and dosbox_single.conf and ignore other confs

I think this is the more straightforward solution. Try to parse .info files is more precise and useful for the future features, but it will take more effort ..

@neuromancer
Copy link
Contributor Author

In the case of Dangerous Dave, maybe you can just iterate over the subdirectories and look for dosbox.conf and dosbox_single.conf (and ignore other confs). This should be enough for that, but I don't know if this will work for games without .info files.

@neuromancer
Copy link
Contributor Author

I think this works quite good so I will close it now. Please note that some games requires manual editing of the single.conf file because they mount some directory or file. Basically, the paths are different: Windows is using \ instead of / and the filenames are case-sensitives in Linux. Maybe a patch to dosbox could help to address these remaining issues?

@neuromancer
Copy link
Contributor Author

This patch allows to detect multiple configs one per directory (for instance Dangerous Dave or Redneck Rampage). The user should select one of these somehow, but I don't know how to implement the actual selection:

diff --git a/src/data/compat/DOSBox.vala b/src/data/compat/DOSBox.vala
index 4bd0abc..da63f46 100644
--- a/src/data/compat/DOSBox.vala
+++ b/src/data/compat/DOSBox.vala
@@ -28,6 +28,7 @@ namespace GameHub.Data.Compat
 
                private File conf_windowed;
                private CompatTool.Option? opt_windowed;
+                private ArrayList<ArrayList<string>> multi_config; 
 
                public DOSBox(string binary="dosbox")
                {
@@ -39,6 +40,7 @@ namespace GameHub.Data.Compat
                private CompatTool.Option? opt_windowed;
                private File conf_windowed;
                private CompatTool.Option? opt_windowed;
+                private ArrayList<ArrayList<string>> multi_config; 
 
                public DOSBox(string binary="dosbox")
                {
@@ -39,6 +40,7 @@ namespace GameHub.Data.Compat
                        id = @"dosbox";
                        name = @"DOSBox";
                        icon = "tool-dosbox-symbolic";
+                        multi_config = new ArrayList<ArrayList<string>>();
 
                        executable = Utils.find_executable(binary);
                        installed = executable != null && executable.query_exists();
@@ -97,23 +99,48 @@ namespace GameHub.Data.Compat
 
                public override bool can_run(Game game)
                {
-                       return installed && find_configs(game.install_dir).size > 0;
+                        var configs = find_configs(game.install_dir);
+                        var has_configs = configs.size > 0;
+                        if (has_configs) {
+                            warning("Found dir %s with dosbox conf", game.install_dir.get_path());       
+                            multi_config.add(configs);
+                        }
+                               FileInfo? finfo = null;
+                       var enumerator = game.install_dir.enumerate_children("standard::*", FileQueryInfoFlags.NOFOLLOW_SYMLINKS);
+                       while((finfo = enumerator.next_file()) != null)
+                       {
+                          if (finfo.get_file_type () == FileType.DIRECTORY) {
+                              File subdir = game.install_dir.resolve_relative_path (finfo.get_name ());
+                              configs = find_configs(subdir);
+                              has_configs = has_configs || configs.size > 0; 
+
+                              if (configs.size > 0) {
+                                  warning("Found dir %s with dosbox conf", subdir.get_path()); 
+                                  multi_config.add(configs);
+                              }
+ 
+                          }
+                        }
+       
+                       return installed && has_configs;
                }
 
                public override async void run(Game game)
                {
                        if(!can_run(game)) return;
+                        warning("multi_config size %d", multi_config.size);
 
                        string[] cmd = { executable.get_path() };
 
                        var wdir = game.install_dir;
 
-                       var configs = find_configs(game.install_dir);
-
+                       var configs = multi_config.get(0); // select some configs
+                        
                        if(configs.size > 2 && game is GameHub.Data.Sources.GOG.GOGGame)
                        {
                                foreach(var conf in configs)
                                {
+                                        warning("Found .conf file: %s", conf); 
                                        if(conf.has_suffix("_single.conf"))
                                        {
                                                configs.clear();

Lucki pushed a commit to Lucki/GameHub that referenced this issue Oct 30, 2021
Allow to force compat even for games which do support Linux (tkashkin#51, tkashkin#52, 
tkashkin#71)


Former-commit-id: 36b90dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants