From 32f9f515379b1a476c68e88dfff474e3f8623ba3 Mon Sep 17 00:00:00 2001 From: SimGamerJen Date: Tue, 25 Aug 2026 20:55:35 +0100 Subject: [PATCH 1/8] Load Avatar Switcher GUI profiles only once --- scripts/AS_GuiLifecycle.lua | 94 +++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 scripts/AS_GuiLifecycle.lua diff --git a/scripts/AS_GuiLifecycle.lua b/scripts/AS_GuiLifecycle.lua new file mode 100644 index 0000000..68bedbc --- /dev/null +++ b/scripts/AS_GuiLifecycle.lua @@ -0,0 +1,94 @@ +-- FS25_AvatarSwitcher +-- ModVersion: 1.0.0.0 +-- File: AS_GuiLifecycle.lua +-- BuildTag: 20260825.1 +-- Centralises custom GUI profile loading so profile names are registered only +-- once per game process, regardless of which Avatar Switcher dialog opens first. + +AvatarSwitcher = AvatarSwitcher or {} + +-- Do not reset this in deleteMap(). GIANTS keeps GUI profiles registered for the +-- lifetime of the process, so loading another save must not register them again. +AvatarSwitcher.guiProfilesLoaded = AvatarSwitcher.guiProfilesLoaded == true + +function AvatarSwitcher:ensureGuiProfilesLoaded() + if self.guiProfilesLoaded == true then + return true + end + + if g_gui == nil or g_gui.loadProfiles == nil then + if self.warn ~= nil then + self:warn("[GUI] Cannot load Avatar Switcher GUI profiles: g_gui.loadProfiles unavailable") + end + return false + end + + local filename = self.modDirectory .. "gui/guiProfiles.xml" + local ok, err = pcall(g_gui.loadProfiles, g_gui, filename) + if not ok then + if self.error ~= nil then + self:error("[GUI] Failed to load GUI profiles: " .. tostring(err)) + else + print("[FS25_AvatarSwitcher/GUI] Failed to load GUI profiles: " .. tostring(err)) + end + return false + end + + self.guiProfilesLoaded = true + if self.debug ~= nil then + self:debug("[GUI] Loaded custom GUI profiles once: " .. tostring(filename)) + end + return true +end + +-- AS_Dialog.lua and AS_SaveDialog.lua historically loaded guiProfiles.xml inside +-- their open routines. Replacing the two open routines here keeps their dialog +-- behaviour unchanged while routing profile registration through the shared guard. + +function AvatarSwitcher:openDialog() + self:initialize() + if g_gui == nil then + self:warn("[Dialog] g_gui is not available") + return false + end + + if self.guiDialog ~= nil then + return true + end + + if not self:ensureGuiProfilesLoaded() then + return false + end + + local dlgFrame = AvatarSwitcherDialog.new(g_i18n) + g_gui:loadGui(self.modDirectory .. "gui/AS_Dialog.xml", "AvatarSwitcherDialog", dlgFrame) + self.guiDialog = g_gui:showDialog("AvatarSwitcherDialog") + + if self.HUD ~= nil then + self.HUD.visible = self.guiDialog ~= nil + end + + return self.guiDialog ~= nil +end + +function AvatarSwitcher:openWardrobeSaveDialog() + self:initialize() + if g_gui == nil then + self:warn("[WardrobeSaveDialog] g_gui is not available") + return false + end + + if self.wardrobeSaveDialog ~= nil then + return true + end + + if not self:ensureGuiProfilesLoaded() then + return false + end + + local dlgFrame = AvatarSwitcherSaveDialog.new(g_i18n) + g_gui:loadGui(self.modDirectory .. "gui/AS_SaveDialog.xml", "AvatarSwitcherSaveDialog", dlgFrame) + self.wardrobeSaveDialog = g_gui:showDialog("AvatarSwitcherSaveDialog") + + return self.wardrobeSaveDialog ~= nil +end From fd28432608c2e7681f41554c1fb80d4518c93b92 Mon Sep 17 00:00:00 2001 From: SimGamerJen Date: Tue, 25 Aug 2026 20:55:55 +0100 Subject: [PATCH 2/8] Apply GIANTS retest description and layout-neutral default key --- modDesc.xml | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/modDesc.xml b/modDesc.xml index e6b5e4d..2e2ac74 100644 --- a/modDesc.xml +++ b/modDesc.xml @@ -23,14 +23,14 @@ Features: - Store presets in the Avatar Switcher mod settings folder Default control: -' opens Avatar Switcher. The key binding can be changed in the in-game controls menu. +F11 opens Avatar Switcher. The key binding can be changed in the in-game controls menu. How to use: 1. Open the wardrobe and configure the player appearance. 2. Select "Save to AvatarSwitcher". 3. Enter a unique Preset ID and an optional Display Name. 4. Select an existing category or enter a new category, then select Save. -5. Press ' to open Avatar Switcher. +5. Press F11 to open Avatar Switcher. 6. Select a category and appearance, then select Apply. Deleting a preset does not change the appearance currently being used. @@ -38,31 +38,31 @@ Deleting a preset does not change the appearance currently being used. This mod is designed for single-player use and does not support multiplayer. ]]> + @@ -119,7 +120,7 @@ Ce mod est conçu pour le mode solo et ne prend pas en charge le multijoueur. - + From 2cf41cce969e9d571587c47fe93f02a5e4fa3099 Mon Sep 17 00:00:00 2001 From: SimGamerJen Date: Tue, 25 Aug 2026 20:56:12 +0100 Subject: [PATCH 3/8] Document F11 default control for ModHub retest --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f499a31..8fcffe4 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ ``` 3. Enable **Avatar Switcher** when loading your save. -4. Press **'** (apostrophe/quote) to open Avatar Switcher. The binding can be changed in the in-game controls menu. +4. Press **F11** to open Avatar Switcher. The binding can be changed in the in-game controls menu. Do not extract the mod ZIP into the mods folder. @@ -53,7 +53,7 @@ Do not extract the mod ZIP into the mods folder. ### Applying an appearance -1. Press the mapped **Open Avatar Switcher** control. +1. Press the mapped **Open Avatar Switcher** control (F11 by default). 2. Select a category. 3. Select a saved appearance. 4. Choose **Apply**. From e0707e2b381d4af0a2ddbc8750d7b09163725abd Mon Sep 17 00:00:00 2001 From: SimGamerJen Date: Tue, 25 Aug 2026 21:01:02 +0100 Subject: [PATCH 4/8] Replace F11 with Ctrl+Alt+A default binding --- modDesc.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modDesc.xml b/modDesc.xml index 2e2ac74..52d2f30 100644 --- a/modDesc.xml +++ b/modDesc.xml @@ -23,14 +23,14 @@ Features: - Store presets in the Avatar Switcher mod settings folder Default control: -F11 opens Avatar Switcher. The key binding can be changed in the in-game controls menu. +Ctrl+Alt+A opens Avatar Switcher. The key binding can be changed in the in-game controls menu. How to use: 1. Open the wardrobe and configure the player appearance. 2. Select "Save to AvatarSwitcher". 3. Enter a unique Preset ID and an optional Display Name. 4. Select an existing category or enter a new category, then select Save. -5. Press F11 to open Avatar Switcher. +5. Press Ctrl+Alt+A to open Avatar Switcher. 6. Select a category and appearance, then select Apply. Deleting a preset does not change the appearance currently being used. @@ -50,14 +50,14 @@ Funktionen: - Speichere Voreinstellungen im Einstellungsordner des Avatar-Wechsler-Mods Standardsteuerung: -F11 öffnet den Avatar-Wechsler. Die Tastenbelegung kann im Steuerungsmenü des Spiels geändert werden. +Ctrl+Alt+A öffnet den Avatar-Wechsler. Die Tastenbelegung kann im Steuerungsmenü des Spiels geändert werden. So funktioniert es: 1. Öffne die Garderobe und passe das Aussehen des Spielers an. 2. Wähle „In Avatar-Wechsler speichern“. 3. Gib eine eindeutige Voreinstellungs-ID und optional einen Anzeigenamen ein. 4. Wähle eine vorhandene Kategorie aus oder gib eine neue Kategorie ein und wähle anschließend „Speichern“. -5. Drücke F11, um den Avatar-Wechsler zu öffnen. +5. Drücke Ctrl+Alt+A, um den Avatar-Wechsler zu öffnen. 6. Wähle eine Kategorie und ein Aussehen aus und wähle anschließend „Übernehmen“. Das Löschen einer Voreinstellung ändert nichts am aktuell verwendeten Aussehen. @@ -77,14 +77,14 @@ Fonctionnalités : - Stocker les préréglages dans le dossier de paramètres du mod Avatar Switcher Commande par défaut : -F11 ouvre Avatar Switcher. Cette touche peut être modifiée dans le menu des commandes du jeu. +Ctrl+Alt+A ouvre Avatar Switcher. Cette touche peut être modifiée dans le menu des commandes du jeu. Utilisation : 1. Ouvrez la garde-robe et configurez l'apparence du joueur. 2. Sélectionnez "Enregistrer dans AvatarSwitcher". 3. Saisissez un ID de préréglage unique et, si vous le souhaitez, un nom d'affichage. 4. Sélectionnez une catégorie existante ou saisissez une nouvelle catégorie, puis sélectionnez Enregistrer. -5. Appuyez sur F11 pour ouvrir Avatar Switcher. +5. Appuyez sur Ctrl+Alt+A pour ouvrir Avatar Switcher. 6. Sélectionnez une catégorie et une apparence, puis sélectionnez Appliquer. La suppression d'un préréglage ne modifie pas l'apparence actuellement utilisée. @@ -115,12 +115,12 @@ Ce mod est conçu pour le mode solo et ne prend pas en charge le multijoueur. - + - + From e58e1711c191791331cab5ebcb0067f87ed1292d Mon Sep 17 00:00:00 2001 From: SimGamerJen Date: Tue, 25 Aug 2026 21:01:20 +0100 Subject: [PATCH 5/8] Document Ctrl+Alt+A default binding --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8fcffe4..ca5eb62 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ ``` 3. Enable **Avatar Switcher** when loading your save. -4. Press **F11** to open Avatar Switcher. The binding can be changed in the in-game controls menu. +4. Press **Ctrl+Alt+A** to open Avatar Switcher. The binding can be changed in the in-game controls menu. Do not extract the mod ZIP into the mods folder. @@ -53,7 +53,7 @@ Do not extract the mod ZIP into the mods folder. ### Applying an appearance -1. Press the mapped **Open Avatar Switcher** control (F11 by default). +1. Press the mapped **Open Avatar Switcher** control (**Ctrl+Alt+A** by default). 2. Select a category. 3. Select a saved appearance. 4. Choose **Apply**. From 8180112d714e053e47c11a1b39b6a4aa6ccbbcd3 Mon Sep 17 00:00:00 2001 From: SimGamerJen Date: Tue, 25 Aug 2026 21:05:46 +0100 Subject: [PATCH 6/8] Use Alt+Shift+A as Avatar Switcher default --- modDesc.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modDesc.xml b/modDesc.xml index 52d2f30..b3f5ef1 100644 --- a/modDesc.xml +++ b/modDesc.xml @@ -23,14 +23,14 @@ Features: - Store presets in the Avatar Switcher mod settings folder Default control: -Ctrl+Alt+A opens Avatar Switcher. The key binding can be changed in the in-game controls menu. +Alt+Shift+A opens Avatar Switcher. The key binding can be changed in the in-game controls menu. How to use: 1. Open the wardrobe and configure the player appearance. 2. Select "Save to AvatarSwitcher". 3. Enter a unique Preset ID and an optional Display Name. 4. Select an existing category or enter a new category, then select Save. -5. Press Ctrl+Alt+A to open Avatar Switcher. +5. Press Alt+Shift+A to open Avatar Switcher. 6. Select a category and appearance, then select Apply. Deleting a preset does not change the appearance currently being used. @@ -50,14 +50,14 @@ Funktionen: - Speichere Voreinstellungen im Einstellungsordner des Avatar-Wechsler-Mods Standardsteuerung: -Ctrl+Alt+A öffnet den Avatar-Wechsler. Die Tastenbelegung kann im Steuerungsmenü des Spiels geändert werden. +Alt+Shift+A öffnet den Avatar-Wechsler. Die Tastenbelegung kann im Steuerungsmenü des Spiels geändert werden. So funktioniert es: 1. Öffne die Garderobe und passe das Aussehen des Spielers an. 2. Wähle „In Avatar-Wechsler speichern“. 3. Gib eine eindeutige Voreinstellungs-ID und optional einen Anzeigenamen ein. 4. Wähle eine vorhandene Kategorie aus oder gib eine neue Kategorie ein und wähle anschließend „Speichern“. -5. Drücke Ctrl+Alt+A, um den Avatar-Wechsler zu öffnen. +5. Drücke Alt+Shift+A, um den Avatar-Wechsler zu öffnen. 6. Wähle eine Kategorie und ein Aussehen aus und wähle anschließend „Übernehmen“. Das Löschen einer Voreinstellung ändert nichts am aktuell verwendeten Aussehen. @@ -77,14 +77,14 @@ Fonctionnalités : - Stocker les préréglages dans le dossier de paramètres du mod Avatar Switcher Commande par défaut : -Ctrl+Alt+A ouvre Avatar Switcher. Cette touche peut être modifiée dans le menu des commandes du jeu. +Alt+Shift+A ouvre Avatar Switcher. Cette touche peut être modifiée dans le menu des commandes du jeu. Utilisation : 1. Ouvrez la garde-robe et configurez l'apparence du joueur. 2. Sélectionnez "Enregistrer dans AvatarSwitcher". 3. Saisissez un ID de préréglage unique et, si vous le souhaitez, un nom d'affichage. 4. Sélectionnez une catégorie existante ou saisissez une nouvelle catégorie, puis sélectionnez Enregistrer. -5. Appuyez sur Ctrl+Alt+A pour ouvrir Avatar Switcher. +5. Appuyez sur Alt+Shift+A pour ouvrir Avatar Switcher. 6. Sélectionnez une catégorie et une apparence, puis sélectionnez Appliquer. La suppression d'un préréglage ne modifie pas l'apparence actuellement utilisée. @@ -120,7 +120,7 @@ Ce mod est conçu pour le mode solo et ne prend pas en charge le multijoueur. - + From 7a7c25d80d379247362d77e4c265606c5edeef6a Mon Sep 17 00:00:00 2001 From: SimGamerJen Date: Tue, 25 Aug 2026 21:06:03 +0100 Subject: [PATCH 7/8] Document Alt+Shift+A default control --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ca5eb62..c1cf690 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ ``` 3. Enable **Avatar Switcher** when loading your save. -4. Press **Ctrl+Alt+A** to open Avatar Switcher. The binding can be changed in the in-game controls menu. +4. Press **Alt+Shift+A** to open Avatar Switcher. The binding can be changed in the in-game controls menu. Do not extract the mod ZIP into the mods folder. @@ -53,7 +53,7 @@ Do not extract the mod ZIP into the mods folder. ### Applying an appearance -1. Press the mapped **Open Avatar Switcher** control (**Ctrl+Alt+A** by default). +1. Press the mapped **Open Avatar Switcher** control (**Alt+Shift+A** by default). 2. Select a category. 3. Select a saved appearance. 4. Choose **Apply**. From bd5a5b66066a30a7e01838432ed7691695dcdabb Mon Sep 17 00:00:00 2001 From: SimGamerJen Date: Tue, 25 Aug 2026 21:06:21 +0100 Subject: [PATCH 8/8] Normalize Alt+Shift+A documentation