Skip to content

Commit ae13ca8

Browse files
committed
update
1 parent a6eb864 commit ae13ca8

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

Bloxstrap/Bootstrapper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ public async Task Run()
300300
// so the optimizations actually take effect for this launch
301301
try
302302
{
303+
// Bersihkan flag lama dari path Roblox standar — cegah kontaminasi antar versi
304+
Integrations.AutoOptimizeService.CleanupLegacyRobloxFlags();
305+
303306
if (App.Settings.Prop.UseFastFlagManager && Integrations.AutoOptimizeService.CheckAndApply())
304307
{
305308
App.Logger.WriteLine(LOG_IDENT, "Auto-optimize: low-end performance FastFlags applied");

Bloxstrap/Integrations/AutoOptimizeService.cs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,89 @@ public static void PurgeAllKnownFlags()
594594
"FFlagDebugDisableTelemetryV2Stat",
595595
};
596596

597+
/// <summary>
598+
/// Bersihkan ClientAppSettings.json di path Roblox default
599+
/// (bukan path BoneFish) dari flag-flag yang pernah kita inject.
600+
///
601+
/// Masalah: BoneFish menulis flags ke path-nya sendiri, tapi jika user
602+
/// pernah pakai versi lama atau preset lama, sisa flags bisa tertinggal
603+
/// di path Roblox standar (%localappdata%\Roblox\Versions\xxx\ClientSettings)
604+
/// dan terus dibaca Roblox meski BoneFish sudah update.
605+
///
606+
/// Dipanggil sekali saat BoneFish launch (dari Bootstrapper.Run) untuk
607+
/// memastikan tidak ada kontaminasi flags lama di path Roblox.
608+
/// </summary>
609+
public static void CleanupLegacyRobloxFlags()
610+
{
611+
try
612+
{
613+
// Path Roblox default — berbeda dari path BoneFish
614+
string robloxVersionsDir = Path.Combine(Paths.LocalAppData, "Roblox", "Versions");
615+
if (!Directory.Exists(robloxVersionsDir))
616+
return;
617+
618+
int cleanedFiles = 0;
619+
620+
// Scan semua folder version-xxx
621+
foreach (string versionDir in Directory.GetDirectories(robloxVersionsDir, "version-*"))
622+
{
623+
string clientSettingsPath = Path.Combine(versionDir, "ClientSettings", "ClientAppSettings.json");
624+
if (!File.Exists(clientSettingsPath))
625+
continue;
626+
627+
try
628+
{
629+
string content = File.ReadAllText(clientSettingsPath).Trim();
630+
631+
// Skip kalau sudah kosong
632+
if (content == "{}" || content == "{ }" || string.IsNullOrWhiteSpace(content))
633+
continue;
634+
635+
// Parse dan hapus semua flag yang kita kelola
636+
var flags = System.Text.Json.JsonSerializer
637+
.Deserialize<Dictionary<string, object>>(content);
638+
639+
if (flags == null || flags.Count == 0)
640+
continue;
641+
642+
bool modified = false;
643+
foreach (string flag in AllKnownManagedFlags)
644+
{
645+
if (flags.Remove(flag))
646+
modified = true;
647+
}
648+
649+
if (modified)
650+
{
651+
string cleaned = System.Text.Json.JsonSerializer
652+
.Serialize(flags, new System.Text.Json.JsonSerializerOptions
653+
{
654+
WriteIndented = true
655+
});
656+
File.WriteAllText(clientSettingsPath, cleaned);
657+
cleanedFiles++;
658+
App.Logger.WriteLine(LOG_IDENT,
659+
$"Cleaned legacy flags from: {clientSettingsPath}");
660+
}
661+
}
662+
catch (Exception ex)
663+
{
664+
// Satu file gagal tidak menghentikan file lainnya
665+
App.Logger.WriteLine(LOG_IDENT,
666+
$"Could not clean {clientSettingsPath}: {ex.Message}");
667+
}
668+
}
669+
670+
if (cleanedFiles > 0)
671+
App.Logger.WriteLine(LOG_IDENT,
672+
$"Legacy flag cleanup done: {cleanedFiles} file(s) cleaned");
673+
}
674+
catch (Exception ex)
675+
{
676+
App.Logger.WriteLine(LOG_IDENT, $"CleanupLegacyRobloxFlags failed (non-fatal): {ex.Message}");
677+
}
678+
}
679+
597680
/// <summary>
598681
/// Dipanggil dari Bootstrapper.StartRoblox() setelah Roblox process berhasil start.
599682
/// Melakukan 3 hal untuk mencegah not-responding pada device RAM terbatas:

0 commit comments

Comments
 (0)