Skip to content

Guitexts toml - #5100

Draft
PieterVdc wants to merge 5 commits into
dkfans:masterfrom
PieterVdc:guitexts_toml
Draft

Guitexts toml#5100
PieterVdc wants to merge 5 commits into
dkfans:masterfrom
PieterVdc:guitexts_toml

Conversation

@PieterVdc

@PieterVdc PieterVdc commented Aug 6, 2026

Copy link
Copy Markdown
Member

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

@PieterVdc
PieterVdc marked this pull request as ready for review August 6, 2026 19:44
Copilot AI lite review requested due to automatic review settings August 6, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.toml as 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 .dat loading path and stop calling setup_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 thread src/config_translation.c
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 thread src/config_translation.c
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 thread src/config_strings.c
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
PieterVdc marked this pull request as draft August 7, 2026 08:24
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.

2 participants