Guitexts toml - #5100
Draft
PieterVdc wants to merge 5 commits into
Draft
Conversation
PieterVdc
marked this pull request as ready for review
August 6, 2026 19:44
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR migrates GUI string loading to the TOML translation pipeline by introducing a dedicated GUI translation config and removing the legacy GUI strings .dat loader.
Changes:
- Add
guistrings.tomlas a new config file (keeper_gui_translation_file_data) and load it during stats initialization. - Extend translation loading to support both campaign translations and GUI translations (writing GUI entries into
gui_strings). - Remove the old GUI strings
.datloading path and stop callingsetup_gui_strings_data()during game setup.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.cpp | Removes GUI strings setup from setup_game() to rely on config-based loading. |
| src/dungeon_stats.c | Loads the new GUI translation config before the existing translation config. |
| src/config_translation.h | Exposes keeper_gui_translation_file_data to callers. |
| src/config_translation.c | Adds separate loaders for campaign vs GUI translations and writes GUI entries to gui_strings. |
| src/config_strings.h | Exposes gui_strings array and removes setup_gui_strings_data() declaration. |
| src/config_strings.c | Deletes legacy GUI strings .dat/mods loading code; adjusts gui_string() behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+56
to
+61
| const struct ConfigFileData keeper_gui_translation_file_data = { | ||
| .filename = "guistrings.toml", | ||
| .load_func = load_gui_translation_config_file, | ||
| .pre_load_func = NULL, | ||
| .post_load_func = NULL, | ||
| }; |
Comment on lines
+142
to
+155
| if (gui_strings[idx]) | ||
| free(gui_strings[idx]); | ||
| gui_strings[idx] = NULL; | ||
|
|
||
| size_t len = strlen(text); | ||
|
|
||
| gui_strings[idx] = (char *)calloc(len + 1, 1); | ||
| if (!gui_strings[idx]) | ||
| { | ||
| ERRORLOG("Out of memory allocating translation text for GUI string index %d.", idx); | ||
| return; | ||
| } | ||
| strncpy(gui_strings[idx], text, len + 1); | ||
| } |
Comment on lines
85
to
90
| TbBool free_gui_strings_data(void) | ||
| { | ||
| // Resetting all values to empty strings | ||
| reset_strings(gui_strings, GUI_STRINGS_COUNT-1); | ||
| // Freeing memory | ||
| for (int i=0; i<gui_strings_data_count; i++) | ||
| { | ||
| KfxFree(gui_strings_data_list[i]); | ||
| gui_strings_data_list[i] = NULL; | ||
| } | ||
| gui_strings_data_count = 0; | ||
| return true; | ||
| } |
PieterVdc
marked this pull request as draft
August 7, 2026 08:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
replace the gtext_xxx.dat files with a big toml
does remove loading the gtext dat from mods as well, so those will need to switch to toml if they relied on dats