LostArtefacts / TRX

Open source re-implementation of Tomb Raider I and Tomb Raider II, along with additional enhancements and bugfixes
https://lostartefacts.dev/
GNU General Public License v3.0
594 stars 37 forks source link

libtrx/config: refactor enforced config approach #1858

Closed lahm86 closed 1 week ago

lahm86 commented 1 week ago

Resolves #1857.

Checklist

Description

This removes the dedicated enforced game modes and save crystals settings from the gameflow files, as these can now be controlled by builders in the main config file. The only exception is the UB gameflow, as we need to continue enforcing save crystals to be disabled there, and this can't be done through the config file. As a result, backwards compatibility is in place as standard with this, while the documentation points to the correct procedure for enforcing settings.

LMK if you think we can remove backwards compatibility for force_game_modes, I'm inclined to perhaps leave it for a while.

This refactors the enforced config control from #1854 into the gameflow and removes the legacy settings for enforcing game modes and save crystals.

github-actions[bot] commented 1 week ago

Download the built assets for this pull request:

rr- commented 1 week ago

What if we try to set the enforced config options in the gameflow file instead? Probably a tough cookie, as we read that file much later. Maybe a separate file such as TR1X-lock.json (or less clumsy naming)? That way the files are free to be shipped and override existing installations, which removes the burden of maintaining backwards compatibility with existing user setups.

lahm86 commented 1 week ago

Ok, I think it's doable and I think it will be nicer in the long-run. If it wasn't for the UB snag we'd be home and dry pretty much 😄

No need to test just yet @walkawayy, @aredfan - I'll let you know when it's updated and ready.

lahm86 commented 1 week ago

Ok, we should be good for testing this now. The gameflow now accepts the enforced_config object as opposed to the main config file. We do this by reading the gameflow at the same time as the config and merging the settings together. The gameflow is then read again later in the load process, and the enforced object is ignored at that point.

The config tool will continue to show where settings are enforced, as it also reads both files now.