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

libtrx/config: refactor enforced config approach #1858

Merged

Conversation

lahm86
Copy link
Collaborator

@lahm86 lahm86 commented Nov 10, 2024

Resolves #1857.

Checklist

  • I have read the coding conventions
  • I have added a changelog entry about what my pull request accomplishes, or it is an internal change

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.

@lahm86 lahm86 added Enhancement Improvement of an existing feature TR1 labels Nov 10, 2024
@lahm86 lahm86 self-assigned this Nov 10, 2024
@lahm86 lahm86 requested review from a team as code owners November 10, 2024 18:10
@lahm86 lahm86 requested review from rr-, walkawayy and aredfan and removed request for a team November 10, 2024 18:10
Copy link

github-actions bot commented Nov 10, 2024

@rr-
Copy link
Collaborator

rr- commented Nov 10, 2024

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
Copy link
Collaborator Author

lahm86 commented Nov 10, 2024

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 lahm86 force-pushed the issue-1857-remove-gf-forced-vars branch 3 times, most recently from f5c22f4 to 698f32a Compare November 11, 2024 11:13
@lahm86 lahm86 changed the title tr1/gameflow: remove enforced settings libtrx/config: refactor enforced config approach Nov 11, 2024
@lahm86
Copy link
Collaborator Author

lahm86 commented Nov 11, 2024

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.

@lahm86 lahm86 added the TR2 label Nov 11, 2024
@@ -165,6 +193,9 @@ bool ConfigFile_Write(const char *path, void (*dump)(JSON_OBJECT *root_obj))
if (old_data != NULL) {
Memory_FreePointer(&old_data);
}
if (enforced_data != NULL) {
Memory_FreePointer(&enforced_data);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memory_Free family already checks for nulls so no need for this double safety.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated.

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

Resolves LostArtefacts#1857.
@lahm86 lahm86 force-pushed the issue-1857-remove-gf-forced-vars branch from 698f32a to 641e00d Compare November 11, 2024 13:09
@lahm86 lahm86 merged commit f0f7edc into LostArtefacts:develop Nov 11, 2024
6 checks passed
@lahm86 lahm86 deleted the issue-1857-remove-gf-forced-vars branch November 11, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improvement of an existing feature TR1 TR2
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Remove gameflow forced variables
3 participants