KEMBAR78
BASE: Add default extrapath and themepahth when running in tree by criezy · Pull Request #4839 · scummvm/scummvm · GitHub
Skip to content

Conversation

@criezy
Copy link
Member

@criezy criezy commented Mar 23, 2023

This means building and running scummvm in tree works out of the box.

Unfortnatelly registering them as defaults would not work as ConfMan::hasKey() returns false when only defined as a default, and in most places this is checked before using those paths. So if we wanted to use defaults we would need to replace all those checks with a check that the path is not empty.

There is a drawback to using the session domain though: it takes priority over all other domains. So a custom extrapath defined for a game will be ignored. I tried to mitigate the issue by only adding those path if they exist(so that it does not break shadow builds for example). I am not sure if this is a big issue or not. I suspect it could be an issue for example when using munt for some games and a custom extrapath for those games to point to the MT32 rom files. There is a workaround that is to explicitly set an extrapath in the global settings so that it is not added to the session settings, but it is not obvious.

So I propose this as a pull request so that the benefit and drawbacks can be discussed and weighted.

@SupSuper
Copy link
Contributor

Note this isn't required in Windows builds since the files are automatically bundled into the EXE.

This means building and running scummvm in tree now works out of the box.

Unfortnatelly registering them as defaults would not work as
ConfMan::hasKey() returns false when only defined as a default, and
in most places this is checked before using those paths. So if we
wanted to use defaults we would need to replace all those checks with
a check that the path is not empty.

There is a drawback to using the session domain though: it takes
priority over all other domains. So a custom extrapath defined for
a game will be ignored. We try to mitigate the issue by only adding
those path if they exist(so that it does not break shadow builds for
example).

Also the change is excluded on Windows as it is not needed there
since the themes and engine data files are embedded in the executable.
@criezy criezy force-pushed the dev-default-paths branch from 3339f59 to 676ece8 Compare March 24, 2023 22:05
@sluicebox
Copy link
Member

sluicebox commented Mar 27, 2023

Very excited to no longer have to answer "where's the yellow?" to my linux friends; I just went through this last week! =)

I know there are a lot of existing call sites, but it might be worth going through and updating them to be clearer, along with registering a default instead of adding a new way. I was browsing through them and even before this change I got confused.

For example, OSystem_AmigaOS::initBackend:

ConfMan.registerDefault("extrapath", "extras/");
ConfMan.registerDefault("themepath", "themes/");

...

if (!ConfMan.hasKey("extrapath")) {
	ConfMan.set("extrapath", "extras/");
}
if (!ConfMan.hasKey("themepath")) {
	ConfMan.set("themepath", "themes/");
}

If you didn't know how this worked (and I don't!), then this just raises questions, and that's before adding a session default.

I just suggest this as someone who occasionally has to use ConfMan, tries to look for consistent precedent, and gets confused by the subtleties and different ways different engines appear to do the same thing.

@sev-
Copy link
Member

sev- commented Mar 28, 2023

Thank you, merging.

@sev- sev- merged commit be98f2a into scummvm:master Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants