From 9b6d379c545672c2d0c21c26e05eb0f7933faa5b Mon Sep 17 00:00:00 2001 From: GingerNinja Date: Sat, 22 Aug 2026 12:27:13 +0200 Subject: [PATCH 1/5] feat: suppress ad, store offer, login streak, and tutorial popups Broaden the existing disable_first_popup from a single first-only interstitial to suppress all ad/interstitial popups via InterstitialViewController.AboutToShow. Add hooks for store pack offer popups (ShopSceneManager.ShowPlcOfferPopup), login streak popups (LoginStreakManager.TryShowStreakPopupForGameSessionStarted), and tutorial/hint popups (TutorialManager.ShowTutorialScreen, both no-arg and 2-arg overloads) behind a new disable_tutorials config setting. Both settings default to false and are documented in all four localized example config files (en, de, fr, nl). --- example_community_patch_settings_de.toml | 5 +- example_community_patch_settings_en.toml | 5 +- example_community_patch_settings_fr.toml | 5 +- example_community_patch_settings_nl.toml | 5 +- mods/src/config.cc | 2 + mods/src/config.h | 1 + mods/src/defaultconfig.h | 1 + mods/src/patches/parts/misc.cc | 84 ++++++++++++++++++++++-- 8 files changed, 99 insertions(+), 9 deletions(-) diff --git a/example_community_patch_settings_de.toml b/example_community_patch_settings_de.toml index b0cd30e83..4b5ba11fc 100644 --- a/example_community_patch_settings_de.toml +++ b/example_community_patch_settings_de.toml @@ -579,9 +579,12 @@ auto_confirm_ft_upgrade = false # Verhindert, dass die Escape-Taste zum Beenden des Spiels auffordert disable_escape_exit = true -# ⚠️ EXPERIMENTELL: Verhindert das Erscheinen des ersten Werbe-Pop-ups +# ⚠️ EXPERIMENTELL: Verhindert das Erscheinen von Werbe-/Interstitial-Pop-ups disable_first_popup = false +# ⚠️ EXPERIMENTELL: Verhindert das Erscheinen von Tutorial-/Hinweis-Pop-ups +disable_tutorials = false + # ⚠️ EXPERIMENTELL: Verhindert die Funktion der standardmäßigen Bewegungstasten disable_move_keys = false diff --git a/example_community_patch_settings_en.toml b/example_community_patch_settings_en.toml index e0b429dd0..380f43ecd 100644 --- a/example_community_patch_settings_en.toml +++ b/example_community_patch_settings_en.toml @@ -579,9 +579,12 @@ auto_confirm_ft_upgrade = false # Prevent "escape" from prompting to exit the game disable_escape_exit = true -# ⚠️ EXPERIMENTAL: Prevent the first popup advert from appearing +# ⚠️ EXPERIMENTAL: Prevent ad/interstitial popups from appearing disable_first_popup = false +# ⚠️ EXPERIMENTAL: Prevent tutorial/hint popups from appearing +disable_tutorials = false + # ⚠️ EXPERIMENTAL: Prevent the standard move keys from working disable_move_keys = false diff --git a/example_community_patch_settings_fr.toml b/example_community_patch_settings_fr.toml index 30c6edc6f..25e256a68 100644 --- a/example_community_patch_settings_fr.toml +++ b/example_community_patch_settings_fr.toml @@ -579,9 +579,12 @@ auto_confirm_ft_upgrade = false # Empêcher "échap" de proposer de quitter le jeu disable_escape_exit = true -# ⚠️ EXPÉRIMENTAL : Empêcher la première publicité pop-up d'apparaître +# ⚠️ EXPÉRIMENTAL : Empêcher les publicités/interstitiels pop-up d'apparaître disable_first_popup = false +# ⚠️ EXPÉRIMENTAL : Empêcher les tutoriels/infobulles pop-up d'apparaître +disable_tutorials = false + # ⚠️ EXPÉRIMENTAL : Empêcher les touches de déplacement standard de fonctionner disable_move_keys = false diff --git a/example_community_patch_settings_nl.toml b/example_community_patch_settings_nl.toml index 11958c018..e14ad0439 100644 --- a/example_community_patch_settings_nl.toml +++ b/example_community_patch_settings_nl.toml @@ -579,9 +579,12 @@ auto_confirm_ft_upgrade = false # Zorgt ervoor dat het gebruiken van "escape" het spel niet sluit disable_escape_exit = true -# ⚠️ EXPERIMENTEEL: Zorgt ervoor dat de eerste advertentie popup niet toont +# ⚠️ EXPERIMENTEEL: Zorgt ervoor dat advertentie/interstitial pop-ups niet verschijnen disable_first_popup = false +# ⚠️ EXPERIMENTEEL: Zorgt ervoor dat tutorial/hint pop-ups niet verschijnen +disable_tutorials = false + # ⚠️ EXPERIMENTEEL: Zorgt ervoor dat de standaard toetsenbord toetsen voor het bewegen niet werken disable_move_keys = false diff --git a/mods/src/config.cc b/mods/src/config.cc index 144254c4e..57895930d 100644 --- a/mods/src/config.cc +++ b/mods/src/config.cc @@ -857,6 +857,8 @@ void Config::Load() get_config_or_default(config, parsed, "ui", "disable_preview_recall", DCU::disable_preview_recall, write_config); this->disable_first_popup = get_config_or_default(config, parsed, "ui", "disable_first_popup", DCU::disable_first_popup, write_config); + this->disable_tutorials = + get_config_or_default(config, parsed, "ui", "disable_tutorials", DCU::disable_tutorials, write_config); this->disable_move_keys = get_config_or_default(config, parsed, "ui", "disable_move_keys", DCU::disable_move_keys, write_config); this->disable_toast_banners = diff --git a/mods/src/config.h b/mods/src/config.h index 2a7c5fe3c..b802fa577 100644 --- a/mods/src/config.h +++ b/mods/src/config.h @@ -192,6 +192,7 @@ class Config final bool disable_galaxy_chat; bool disable_veil_chat; bool disable_first_popup; + bool disable_tutorials; bool disable_toast_banners; bool auto_open_bulk_claim_flyout; bool auto_confirm_ft_upgrade; diff --git a/mods/src/defaultconfig.h b/mods/src/defaultconfig.h index 2853d23a8..90fce7d66 100644 --- a/mods/src/defaultconfig.h +++ b/mods/src/defaultconfig.h @@ -211,6 +211,7 @@ namespace UI constexpr bool auto_open_bulk_claim_flyout = false; constexpr bool disable_escape_exit = true; constexpr bool disable_first_popup = false; + constexpr bool disable_tutorials = false; constexpr bool disable_galaxy_chat = false; constexpr bool disable_move_keys = false; constexpr bool disable_preview_locate = false; diff --git a/mods/src/patches/parts/misc.cc b/mods/src/patches/parts/misc.cc index 23ce5dbd2..eedf573b3 100644 --- a/mods/src/patches/parts/misc.cc +++ b/mods/src/patches/parts/misc.cc @@ -185,19 +185,48 @@ class ShopSectionContext } }; -bool isFirstInterstitial = true; - void InterstitialViewController_AboutToShow(auto original, InterstitialViewController* _this) { - if (false /* TEMP: disable_first_popup effect disabled */ && Config::Get().disable_first_popup - && isFirstInterstitial && _this != nullptr) { - isFirstInterstitial = false; + if (Config::Get().disable_first_popup && _this != nullptr) { + spdlog::debug("InterstitialViewController_AboutToShow: suppressing interstitial popup"); _this->CloseWhenReady(); } else { original(_this); } } +void ShopSceneManager_ShowPlcOfferPopup(auto original, void* _this) +{ + if (Config::Get().disable_first_popup) { + spdlog::debug("ShopSceneManager_ShowPlcOfferPopup: suppressing PLC offer popup"); + return; + } + original(_this); +} + +bool LoginStreakManager_TryShowStreakPopupForGameSessionStarted(auto original, void* _this) +{ + if (Config::Get().disable_first_popup) { + spdlog::debug("LoginStreakManager_TryShowStreakPopupForGameSessionStarted: suppressing login streak popup"); + return false; + } + return original(_this); +} + +void TutorialManager_ShowTutorialScreen(auto original, void* _this) +{ + if (!Config::Get().disable_tutorials) { + original(_this); + } +} + +void TutorialManager_ShowTutorialScreen_2(auto original, void* _this, void* tutorialComponent, void* tutorialStep) +{ + if (!Config::Get().disable_tutorials) { + original(_this, tutorialComponent, tutorialStep); + } +} + void ActionQueueManager_AddActionToQueue(auto original, ActionQueueManager* _this, long fleet_id) { spdlog::warn("ActionQueueManager_AddActionToQueue({})", fleet_id); @@ -246,6 +275,51 @@ void InstallTempCrashFixes() } } + static auto shop_scene_manager_cls = + il2cpp_get_class_helper("Assembly-CSharp", "Digit.Prime.Shop", "ShopSceneManager"); + if (!shop_scene_manager_cls.isValidHelper()) { + ErrorMsg::MissingHelper("Shop", "ShopSceneManager"); + } else { + auto show_plc = shop_scene_manager_cls.GetMethod("ShowPlcOfferPopup", 0); + if (!show_plc) { + ErrorMsg::MissingMethod("ShopSceneManager", "ShowPlcOfferPopup"); + } else { + SPUD_STATIC_DETOUR(show_plc, ShopSceneManager_ShowPlcOfferPopup); + } + } + + static auto login_streak_manager = + il2cpp_get_class_helper("Assembly-CSharp", "Digit.Prime.LoginStreak", "LoginStreakManager"); + if (!login_streak_manager.isValidHelper()) { + ErrorMsg::MissingHelper("LoginStreak", "LoginStreakManager"); + } else { + auto show_streak = login_streak_manager.GetMethod("TryShowStreakPopupForGameSessionStarted", 0); + if (!show_streak) { + ErrorMsg::MissingMethod("LoginStreakManager", "TryShowStreakPopupForGameSessionStarted"); + } else { + SPUD_STATIC_DETOUR(show_streak, LoginStreakManager_TryShowStreakPopupForGameSessionStarted); + } + } + + static auto tutorial_manager = + il2cpp_get_class_helper("Assembly-CSharp", "Digit.Prime.Tutorial", "TutorialManager"); + if (!tutorial_manager.isValidHelper()) { + ErrorMsg::MissingHelper("Tutorial", "TutorialManager"); + } else { + auto show_tutorial_screen = tutorial_manager.GetMethod("ShowTutorialScreen", 0); + if (!show_tutorial_screen) { + ErrorMsg::MissingMethod("TutorialManager", "ShowTutorialScreen"); + } else { + SPUD_STATIC_DETOUR(show_tutorial_screen, TutorialManager_ShowTutorialScreen); + } + auto show_tutorial_screen_2 = tutorial_manager.GetMethod("ShowTutorialScreen", 2); + if (!show_tutorial_screen_2) { + ErrorMsg::MissingMethod("TutorialManager", "ShowTutorialScreen(2)"); + } else { + SPUD_STATIC_DETOUR(show_tutorial_screen_2, TutorialManager_ShowTutorialScreen_2); + } + } + static auto actionqueue_manager = il2cpp_get_class_helper("Assembly-CSharp", "Prime.ActionQueue", "ActionQueueManager"); if (!actionqueue_manager.isValidHelper()) { From d16d4fd9fd1879ead8cc295096f8c44ee9cdbe5e Mon Sep 17 00:00:00 2001 From: GingerNinja Date: Sat, 22 Aug 2026 20:25:02 +0200 Subject: [PATCH 2/5] refactor: remove experimental tutorial skipping --- example_community_patch_settings_de.toml | 3 - example_community_patch_settings_en.toml | 3 - example_community_patch_settings_fr.toml | 3 - example_community_patch_settings_nl.toml | 3 - mods/src/config.cc | 2 - mods/src/config.h | 1 - mods/src/defaultconfig.h | 1 - mods/src/patches/parts/misc.cc | 77 +++--------------------- 8 files changed, 8 insertions(+), 85 deletions(-) diff --git a/example_community_patch_settings_de.toml b/example_community_patch_settings_de.toml index 4b5ba11fc..f3a2c7fd9 100644 --- a/example_community_patch_settings_de.toml +++ b/example_community_patch_settings_de.toml @@ -582,9 +582,6 @@ disable_escape_exit = true # ⚠️ EXPERIMENTELL: Verhindert das Erscheinen von Werbe-/Interstitial-Pop-ups disable_first_popup = false -# ⚠️ EXPERIMENTELL: Verhindert das Erscheinen von Tutorial-/Hinweis-Pop-ups -disable_tutorials = false - # ⚠️ EXPERIMENTELL: Verhindert die Funktion der standardmäßigen Bewegungstasten disable_move_keys = false diff --git a/example_community_patch_settings_en.toml b/example_community_patch_settings_en.toml index 380f43ecd..2a88e98dd 100644 --- a/example_community_patch_settings_en.toml +++ b/example_community_patch_settings_en.toml @@ -582,9 +582,6 @@ disable_escape_exit = true # ⚠️ EXPERIMENTAL: Prevent ad/interstitial popups from appearing disable_first_popup = false -# ⚠️ EXPERIMENTAL: Prevent tutorial/hint popups from appearing -disable_tutorials = false - # ⚠️ EXPERIMENTAL: Prevent the standard move keys from working disable_move_keys = false diff --git a/example_community_patch_settings_fr.toml b/example_community_patch_settings_fr.toml index 25e256a68..30d54271c 100644 --- a/example_community_patch_settings_fr.toml +++ b/example_community_patch_settings_fr.toml @@ -582,9 +582,6 @@ disable_escape_exit = true # ⚠️ EXPÉRIMENTAL : Empêcher les publicités/interstitiels pop-up d'apparaître disable_first_popup = false -# ⚠️ EXPÉRIMENTAL : Empêcher les tutoriels/infobulles pop-up d'apparaître -disable_tutorials = false - # ⚠️ EXPÉRIMENTAL : Empêcher les touches de déplacement standard de fonctionner disable_move_keys = false diff --git a/example_community_patch_settings_nl.toml b/example_community_patch_settings_nl.toml index e14ad0439..0f9820bfc 100644 --- a/example_community_patch_settings_nl.toml +++ b/example_community_patch_settings_nl.toml @@ -582,9 +582,6 @@ disable_escape_exit = true # ⚠️ EXPERIMENTEEL: Zorgt ervoor dat advertentie/interstitial pop-ups niet verschijnen disable_first_popup = false -# ⚠️ EXPERIMENTEEL: Zorgt ervoor dat tutorial/hint pop-ups niet verschijnen -disable_tutorials = false - # ⚠️ EXPERIMENTEEL: Zorgt ervoor dat de standaard toetsenbord toetsen voor het bewegen niet werken disable_move_keys = false diff --git a/mods/src/config.cc b/mods/src/config.cc index 57895930d..144254c4e 100644 --- a/mods/src/config.cc +++ b/mods/src/config.cc @@ -857,8 +857,6 @@ void Config::Load() get_config_or_default(config, parsed, "ui", "disable_preview_recall", DCU::disable_preview_recall, write_config); this->disable_first_popup = get_config_or_default(config, parsed, "ui", "disable_first_popup", DCU::disable_first_popup, write_config); - this->disable_tutorials = - get_config_or_default(config, parsed, "ui", "disable_tutorials", DCU::disable_tutorials, write_config); this->disable_move_keys = get_config_or_default(config, parsed, "ui", "disable_move_keys", DCU::disable_move_keys, write_config); this->disable_toast_banners = diff --git a/mods/src/config.h b/mods/src/config.h index b802fa577..2a7c5fe3c 100644 --- a/mods/src/config.h +++ b/mods/src/config.h @@ -192,7 +192,6 @@ class Config final bool disable_galaxy_chat; bool disable_veil_chat; bool disable_first_popup; - bool disable_tutorials; bool disable_toast_banners; bool auto_open_bulk_claim_flyout; bool auto_confirm_ft_upgrade; diff --git a/mods/src/defaultconfig.h b/mods/src/defaultconfig.h index 90fce7d66..2853d23a8 100644 --- a/mods/src/defaultconfig.h +++ b/mods/src/defaultconfig.h @@ -211,7 +211,6 @@ namespace UI constexpr bool auto_open_bulk_claim_flyout = false; constexpr bool disable_escape_exit = true; constexpr bool disable_first_popup = false; - constexpr bool disable_tutorials = false; constexpr bool disable_galaxy_chat = false; constexpr bool disable_move_keys = false; constexpr bool disable_preview_locate = false; diff --git a/mods/src/patches/parts/misc.cc b/mods/src/patches/parts/misc.cc index eedf573b3..fec8444fc 100644 --- a/mods/src/patches/parts/misc.cc +++ b/mods/src/patches/parts/misc.cc @@ -204,29 +204,6 @@ void ShopSceneManager_ShowPlcOfferPopup(auto original, void* _this) original(_this); } -bool LoginStreakManager_TryShowStreakPopupForGameSessionStarted(auto original, void* _this) -{ - if (Config::Get().disable_first_popup) { - spdlog::debug("LoginStreakManager_TryShowStreakPopupForGameSessionStarted: suppressing login streak popup"); - return false; - } - return original(_this); -} - -void TutorialManager_ShowTutorialScreen(auto original, void* _this) -{ - if (!Config::Get().disable_tutorials) { - original(_this); - } -} - -void TutorialManager_ShowTutorialScreen_2(auto original, void* _this, void* tutorialComponent, void* tutorialStep) -{ - if (!Config::Get().disable_tutorials) { - original(_this, tutorialComponent, tutorialStep); - } -} - void ActionQueueManager_AddActionToQueue(auto original, ActionQueueManager* _this, long fleet_id) { spdlog::warn("ActionQueueManager_AddActionToQueue({})", fleet_id); @@ -250,7 +227,7 @@ void InstallTempCrashFixes() } } - auto shop_scene_manager = il2cpp_get_class_helper("Assembly-CSharp", "Digit.Prime.Shop", "ShopSceneManager"); + static auto shop_scene_manager = il2cpp_get_class_helper("Assembly-CSharp", "Digit.Prime.Shop", "ShopSceneManager"); if (!shop_scene_manager.isValidHelper()) { ErrorMsg::MissingHelper("Shop", "ShopSceneManager"); } else { @@ -260,6 +237,13 @@ void InstallTempCrashFixes() } else { SPUD_STATIC_DETOUR(reveal_show, ShouldShowRevealHook); } + + auto show_plc = shop_scene_manager.GetMethod("ShowPlcOfferPopup", 0); + if (!show_plc) { + ErrorMsg::MissingMethod("ShopSceneManager", "ShowPlcOfferPopup"); + } else { + SPUD_STATIC_DETOUR(show_plc, ShopSceneManager_ShowPlcOfferPopup); + } } static auto interstitial_controller = @@ -275,51 +259,6 @@ void InstallTempCrashFixes() } } - static auto shop_scene_manager_cls = - il2cpp_get_class_helper("Assembly-CSharp", "Digit.Prime.Shop", "ShopSceneManager"); - if (!shop_scene_manager_cls.isValidHelper()) { - ErrorMsg::MissingHelper("Shop", "ShopSceneManager"); - } else { - auto show_plc = shop_scene_manager_cls.GetMethod("ShowPlcOfferPopup", 0); - if (!show_plc) { - ErrorMsg::MissingMethod("ShopSceneManager", "ShowPlcOfferPopup"); - } else { - SPUD_STATIC_DETOUR(show_plc, ShopSceneManager_ShowPlcOfferPopup); - } - } - - static auto login_streak_manager = - il2cpp_get_class_helper("Assembly-CSharp", "Digit.Prime.LoginStreak", "LoginStreakManager"); - if (!login_streak_manager.isValidHelper()) { - ErrorMsg::MissingHelper("LoginStreak", "LoginStreakManager"); - } else { - auto show_streak = login_streak_manager.GetMethod("TryShowStreakPopupForGameSessionStarted", 0); - if (!show_streak) { - ErrorMsg::MissingMethod("LoginStreakManager", "TryShowStreakPopupForGameSessionStarted"); - } else { - SPUD_STATIC_DETOUR(show_streak, LoginStreakManager_TryShowStreakPopupForGameSessionStarted); - } - } - - static auto tutorial_manager = - il2cpp_get_class_helper("Assembly-CSharp", "Digit.Prime.Tutorial", "TutorialManager"); - if (!tutorial_manager.isValidHelper()) { - ErrorMsg::MissingHelper("Tutorial", "TutorialManager"); - } else { - auto show_tutorial_screen = tutorial_manager.GetMethod("ShowTutorialScreen", 0); - if (!show_tutorial_screen) { - ErrorMsg::MissingMethod("TutorialManager", "ShowTutorialScreen"); - } else { - SPUD_STATIC_DETOUR(show_tutorial_screen, TutorialManager_ShowTutorialScreen); - } - auto show_tutorial_screen_2 = tutorial_manager.GetMethod("ShowTutorialScreen", 2); - if (!show_tutorial_screen_2) { - ErrorMsg::MissingMethod("TutorialManager", "ShowTutorialScreen(2)"); - } else { - SPUD_STATIC_DETOUR(show_tutorial_screen_2, TutorialManager_ShowTutorialScreen_2); - } - } - static auto actionqueue_manager = il2cpp_get_class_helper("Assembly-CSharp", "Prime.ActionQueue", "ActionQueueManager"); if (!actionqueue_manager.isValidHelper()) { From 3d3c3432261a89d6df521ba603ccb470c6e8cf2a Mon Sep 17 00:00:00 2001 From: GingerNinja Date: Sat, 22 Aug 2026 20:42:33 +0200 Subject: [PATCH 3/5] fix: suppress interstitial popups by skipping AboutToShow instead of calling CloseWhenReady --- mods/src/patches/parts/misc.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mods/src/patches/parts/misc.cc b/mods/src/patches/parts/misc.cc index fec8444fc..ddbad9561 100644 --- a/mods/src/patches/parts/misc.cc +++ b/mods/src/patches/parts/misc.cc @@ -187,12 +187,11 @@ class ShopSectionContext void InterstitialViewController_AboutToShow(auto original, InterstitialViewController* _this) { - if (Config::Get().disable_first_popup && _this != nullptr) { + if (Config::Get().disable_first_popup) { spdlog::debug("InterstitialViewController_AboutToShow: suppressing interstitial popup"); - _this->CloseWhenReady(); - } else { - original(_this); + return; } + original(_this); } void ShopSceneManager_ShowPlcOfferPopup(auto original, void* _this) From 0dea54ba1b4c9636bfdcfef220c5c8bb75b95a21 Mon Sep 17 00:00:00 2001 From: GingerNinja Date: Sat, 22 Aug 2026 20:45:13 +0200 Subject: [PATCH 4/5] fix: call original AboutToShow before closing to avoid empty screen --- mods/src/patches/parts/misc.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/src/patches/parts/misc.cc b/mods/src/patches/parts/misc.cc index ddbad9561..840c7e700 100644 --- a/mods/src/patches/parts/misc.cc +++ b/mods/src/patches/parts/misc.cc @@ -187,11 +187,11 @@ class ShopSectionContext void InterstitialViewController_AboutToShow(auto original, InterstitialViewController* _this) { - if (Config::Get().disable_first_popup) { + original(_this); + if (Config::Get().disable_first_popup && _this != nullptr) { spdlog::debug("InterstitialViewController_AboutToShow: suppressing interstitial popup"); - return; + _this->CloseWhenReady(); } - original(_this); } void ShopSceneManager_ShowPlcOfferPopup(auto original, void* _this) From f2cc5161123cf79494e2aafe3106aaa5cc8f2983 Mon Sep 17 00:00:00 2001 From: GingerNinja Date: Tue, 25 Aug 2026 11:32:34 +0200 Subject: [PATCH 5/5] feat: change to only_show_first_popup config --- example_community_patch_settings_de.toml | 4 ++-- example_community_patch_settings_en.toml | 4 ++-- example_community_patch_settings_fr.toml | 4 ++-- example_community_patch_settings_nl.toml | 4 ++-- mods/src/config.cc | 4 ++-- mods/src/config.h | 2 +- mods/src/defaultconfig.h | 2 +- mods/src/patches/parts/misc.cc | 23 ++++++++++++++++++----- 8 files changed, 30 insertions(+), 17 deletions(-) diff --git a/example_community_patch_settings_de.toml b/example_community_patch_settings_de.toml index f3a2c7fd9..b36391d9d 100644 --- a/example_community_patch_settings_de.toml +++ b/example_community_patch_settings_de.toml @@ -579,8 +579,8 @@ auto_confirm_ft_upgrade = false # Verhindert, dass die Escape-Taste zum Beenden des Spiels auffordert disable_escape_exit = true -# ⚠️ EXPERIMENTELL: Verhindert das Erscheinen von Werbe-/Interstitial-Pop-ups -disable_first_popup = false +# ⚠️ EXPERIMENTELL: Zeigt nur das erste Werbe-/Interstitial-Pop-up nach dem Start des Spiels an und unterdrückt die übrigen +only_show_first_popup = false # ⚠️ EXPERIMENTELL: Verhindert die Funktion der standardmäßigen Bewegungstasten disable_move_keys = false diff --git a/example_community_patch_settings_en.toml b/example_community_patch_settings_en.toml index 2a88e98dd..d260fc1b5 100644 --- a/example_community_patch_settings_en.toml +++ b/example_community_patch_settings_en.toml @@ -579,8 +579,8 @@ auto_confirm_ft_upgrade = false # Prevent "escape" from prompting to exit the game disable_escape_exit = true -# ⚠️ EXPERIMENTAL: Prevent ad/interstitial popups from appearing -disable_first_popup = false +# ⚠️ EXPERIMENTAL: Show only the first ad/interstitial popup after the game starts, then suppress the rest +only_show_first_popup = false # ⚠️ EXPERIMENTAL: Prevent the standard move keys from working disable_move_keys = false diff --git a/example_community_patch_settings_fr.toml b/example_community_patch_settings_fr.toml index 30d54271c..0834b88d4 100644 --- a/example_community_patch_settings_fr.toml +++ b/example_community_patch_settings_fr.toml @@ -579,8 +579,8 @@ auto_confirm_ft_upgrade = false # Empêcher "échap" de proposer de quitter le jeu disable_escape_exit = true -# ⚠️ EXPÉRIMENTAL : Empêcher les publicités/interstitiels pop-up d'apparaître -disable_first_popup = false +# ⚠️ EXPÉRIMENTAL : Afficher uniquement la première publicité/interstitiel pop-up après le démarrage du jeu, puis supprimer les suivantes +only_show_first_popup = false # ⚠️ EXPÉRIMENTAL : Empêcher les touches de déplacement standard de fonctionner disable_move_keys = false diff --git a/example_community_patch_settings_nl.toml b/example_community_patch_settings_nl.toml index 0f9820bfc..5c7a25b49 100644 --- a/example_community_patch_settings_nl.toml +++ b/example_community_patch_settings_nl.toml @@ -579,8 +579,8 @@ auto_confirm_ft_upgrade = false # Zorgt ervoor dat het gebruiken van "escape" het spel niet sluit disable_escape_exit = true -# ⚠️ EXPERIMENTEEL: Zorgt ervoor dat advertentie/interstitial pop-ups niet verschijnen -disable_first_popup = false +# ⚠️ EXPERIMENTEEL: Toont alleen de eerste advertentie/interstitial pop-up na het starten van het spel en onderdrukt de rest +only_show_first_popup = false # ⚠️ EXPERIMENTEEL: Zorgt ervoor dat de standaard toetsenbord toetsen voor het bewegen niet werken disable_move_keys = false diff --git a/mods/src/config.cc b/mods/src/config.cc index 144254c4e..d655b5ebf 100644 --- a/mods/src/config.cc +++ b/mods/src/config.cc @@ -855,8 +855,8 @@ void Config::Load() get_config_or_default(config, parsed, "ui", "disable_preview_locate", DCU::disable_preview_locate, write_config); this->disable_preview_recall = get_config_or_default(config, parsed, "ui", "disable_preview_recall", DCU::disable_preview_recall, write_config); - this->disable_first_popup = - get_config_or_default(config, parsed, "ui", "disable_first_popup", DCU::disable_first_popup, write_config); + this->only_show_first_popup = get_config_or_default(config, parsed, "ui", "only_show_first_popup", + DCU::only_show_first_popup, write_config); this->disable_move_keys = get_config_or_default(config, parsed, "ui", "disable_move_keys", DCU::disable_move_keys, write_config); this->disable_toast_banners = diff --git a/mods/src/config.h b/mods/src/config.h index 2a7c5fe3c..62fd88a2e 100644 --- a/mods/src/config.h +++ b/mods/src/config.h @@ -191,7 +191,7 @@ class Config final bool disable_escape_exit; bool disable_galaxy_chat; bool disable_veil_chat; - bool disable_first_popup; + bool only_show_first_popup; bool disable_toast_banners; bool auto_open_bulk_claim_flyout; bool auto_confirm_ft_upgrade; diff --git a/mods/src/defaultconfig.h b/mods/src/defaultconfig.h index 2853d23a8..dc53ff9e4 100644 --- a/mods/src/defaultconfig.h +++ b/mods/src/defaultconfig.h @@ -210,7 +210,7 @@ namespace UI constexpr bool auto_confirm_ft_upgrade = false; constexpr bool auto_open_bulk_claim_flyout = false; constexpr bool disable_escape_exit = true; - constexpr bool disable_first_popup = false; + constexpr bool only_show_first_popup = false; constexpr bool disable_galaxy_chat = false; constexpr bool disable_move_keys = false; constexpr bool disable_preview_locate = false; diff --git a/mods/src/patches/parts/misc.cc b/mods/src/patches/parts/misc.cc index 840c7e700..02763adbf 100644 --- a/mods/src/patches/parts/misc.cc +++ b/mods/src/patches/parts/misc.cc @@ -17,6 +17,7 @@ #endif #include +#include #include #include @@ -185,19 +186,31 @@ class ShopSectionContext } }; +static std::atomic_bool g_first_popup_shown{false}; + +bool ShouldSuppressAdditionalPopup() +{ + bool expected = false; + return !g_first_popup_shown.compare_exchange_strong(expected, true); +} + void InterstitialViewController_AboutToShow(auto original, InterstitialViewController* _this) { original(_this); - if (Config::Get().disable_first_popup && _this != nullptr) { - spdlog::debug("InterstitialViewController_AboutToShow: suppressing interstitial popup"); - _this->CloseWhenReady(); + if (Config::Get().only_show_first_popup && _this != nullptr) { + if (ShouldSuppressAdditionalPopup()) { + spdlog::debug("InterstitialViewController_AboutToShow: suppressing interstitial popup (already shown one)"); + _this->CloseWhenReady(); + } else { + spdlog::debug("InterstitialViewController_AboutToShow: allowing first popup of the session to show"); + } } } void ShopSceneManager_ShowPlcOfferPopup(auto original, void* _this) { - if (Config::Get().disable_first_popup) { - spdlog::debug("ShopSceneManager_ShowPlcOfferPopup: suppressing PLC offer popup"); + if (Config::Get().only_show_first_popup && ShouldSuppressAdditionalPopup()) { + spdlog::debug("ShopSceneManager_ShowPlcOfferPopup: suppressing PLC offer popup (already shown one)"); return; } original(_this);