From 713d40088c55c0a89e0dd076dc749b875917cb47 Mon Sep 17 00:00:00 2001 From: Ellendar Date: Wed, 27 May 2026 00:30:37 -0400 Subject: [PATCH 1/2] restored rooms file MD5 check for non-custom rooms file. --- CrossPlatformUI/ViewModels/GenerateRomViewModel.cs | 2 +- RandomizerCore/Hyrule.cs | 6 ++++-- RandomizerCore/Sidescroll/PalaceRooms.cs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CrossPlatformUI/ViewModels/GenerateRomViewModel.cs b/CrossPlatformUI/ViewModels/GenerateRomViewModel.cs index bba7c633..58c32075 100644 --- a/CrossPlatformUI/ViewModels/GenerateRomViewModel.cs +++ b/CrossPlatformUI/ViewModels/GenerateRomViewModel.cs @@ -82,7 +82,7 @@ async void Randomize(CompositeDisposable disposables) var roomsJson = await files!.OpenFile(IFileSystemService.RandomizerPath.Palaces, "PalaceRooms.json"); var customJson = config.UseCustomRooms ? await files.OpenFile(IFileSystemService.RandomizerPath.Palaces, "CustomRooms.json") : null; var rooms = config.UseCustomRooms ? customJson : roomsJson; - var palaceRooms = new PalaceRooms(rooms!, config.UseCustomRooms); + var palaceRooms = new PalaceRooms(rooms!, !config.UseCustomRooms); var randomizer = new Hyrule(createAsm!, palaceRooms); Dispatcher.UIThread.Post(GenerateSeed, DispatcherPriority.Background); return; diff --git a/RandomizerCore/Hyrule.cs b/RandomizerCore/Hyrule.cs index 913f9058..0a030d0b 100644 --- a/RandomizerCore/Hyrule.cs +++ b/RandomizerCore/Hyrule.cs @@ -267,6 +267,8 @@ public async Task Randomize(byte[] vanillaRomData, RandomizerC throw new UserFacingException("Vanilla ROM checksum failure", "Please provide an unmodified Zelda 2 ROM (US release)."); } + byte [] roomsFileHash = MD5Hash.ComputeHash(new UTF8Encoding().GetBytes(Util.ReadAllTextFromFile(config.GetRoomsFile()))); + // Make a copy of the vanilla data to prevent seed bleed ROMData = new ROM(vanillaRomData.ToArray(), true); @@ -502,8 +504,8 @@ public async Task Randomize(byte[] vanillaRomData, RandomizerC byte[] hash = MD5Hash.ComputeHash(Encoding.UTF8.GetBytes( Flags + SeedHash + - randoRomHash + // ideally this should be all that's required - // Util.ReadAllTextFromFile(config.GetRoomsFile()) + + randoRomHash + + roomsFileHash + Util.ByteArrayToHexString(finalRNGState) )); diff --git a/RandomizerCore/Sidescroll/PalaceRooms.cs b/RandomizerCore/Sidescroll/PalaceRooms.cs index 1f3b3de5..aa7c7ab6 100644 --- a/RandomizerCore/Sidescroll/PalaceRooms.cs +++ b/RandomizerCore/Sidescroll/PalaceRooms.cs @@ -13,7 +13,7 @@ public partial class PalaceRooms private readonly Dictionary roomsByName = new(); - public static readonly string roomsMD5 = "JCa3OsnJhIe/fZ5yrx/+mA=="; + public static readonly string roomsMD5 = "PH/R/F8fbGvk60LAskt8Sg=="; public PalaceRooms(string palaceJson, bool doValidation) { From ef16976b492e6a30bcc904feb6a4003cf9d65f9a Mon Sep 17 00:00:00 2001 From: Ellendar Date: Wed, 27 May 2026 00:56:08 -0400 Subject: [PATCH 2/2] Revert "Merge branch '5.2' into main" This reverts commit 85423e80cd98c95f1230fb03f4d608330a2b56a3, reversing changes made to af410a6b89a445868d76e56f5d051c69dbbd344f. --- CrossPlatformUI/ViewModels/GenerateRomViewModel.cs | 2 +- RandomizerCore/Hyrule.cs | 13 ------------- RandomizerCore/Sidescroll/PalaceRooms.cs | 2 +- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/CrossPlatformUI/ViewModels/GenerateRomViewModel.cs b/CrossPlatformUI/ViewModels/GenerateRomViewModel.cs index d29376f3..20e1c532 100644 --- a/CrossPlatformUI/ViewModels/GenerateRomViewModel.cs +++ b/CrossPlatformUI/ViewModels/GenerateRomViewModel.cs @@ -82,7 +82,7 @@ async void Randomize(CompositeDisposable disposables) var roomsJson = await files!.OpenFile(IFileSystemService.RandomizerPath.Palaces, "PalaceRooms.json"); var customJson = config.UseCustomRooms ? await files.OpenFile(IFileSystemService.RandomizerPath.Palaces, "CustomRooms.json") : null; var rooms = config.UseCustomRooms ? customJson : roomsJson; - var palaceRooms = new PalaceRooms(rooms!, !config.UseCustomRooms); + var palaceRooms = new PalaceRooms(rooms!, config.UseCustomRooms); var randomizer = new Hyrule(createAsm!, palaceRooms); Dispatcher.UIThread.Post(GenerateSeed, DispatcherPriority.Background); return; diff --git a/RandomizerCore/Hyrule.cs b/RandomizerCore/Hyrule.cs index 27fdf67a..f265edda 100644 --- a/RandomizerCore/Hyrule.cs +++ b/RandomizerCore/Hyrule.cs @@ -272,8 +272,6 @@ public async Task Randomize(byte[] vanillaRomData, RandomizerC throw new UserFacingException("Vanilla ROM checksum failure", "Please provide an unmodified Zelda 2 ROM (US release)."); } - byte [] roomsFileHash = MD5Hash.ComputeHash(new UTF8Encoding().GetBytes(Util.ReadAllTextFromFile(config.GetRoomsFile()))); - // Make a copy of the vanilla data to prevent seed bleed ROMData = new ROM(vanillaRomData.ToArray(), true); @@ -518,17 +516,6 @@ public async Task Randomize(byte[] vanillaRomData, RandomizerC } } - byte[] finalRNGState = new byte[32]; - - r.NextBytes(finalRNGState); - byte[] hash = MD5Hash.ComputeHash(Encoding.UTF8.GetBytes( - Flags + - SeedHash + - randoRomHash + - roomsFileHash + - Util.ByteArrayToHexString(finalRNGState) - )); - UpdateRom(); byte[] z2Hash; diff --git a/RandomizerCore/Sidescroll/PalaceRooms.cs b/RandomizerCore/Sidescroll/PalaceRooms.cs index aa7c7ab6..1f3b3de5 100644 --- a/RandomizerCore/Sidescroll/PalaceRooms.cs +++ b/RandomizerCore/Sidescroll/PalaceRooms.cs @@ -13,7 +13,7 @@ public partial class PalaceRooms private readonly Dictionary roomsByName = new(); - public static readonly string roomsMD5 = "PH/R/F8fbGvk60LAskt8Sg=="; + public static readonly string roomsMD5 = "JCa3OsnJhIe/fZ5yrx/+mA=="; public PalaceRooms(string palaceJson, bool doValidation) {