From fdad137ff968c01cf7ae7cfc3cb01d036f15d077 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 3 Sep 2016 11:53:18 -0400 Subject: [PATCH] add ability to set the initial wram pattern on neshawk, currently no ui for this, must be done by directly editing a movie file sync settings --- .../Consoles/Nintendo/NES/NES.Core.cs | 30 +++++++++++++++---- .../Consoles/Nintendo/NES/NES.ISettable.cs | 5 ++++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs index 6f617561bc..b0a9d05c0f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.Core.cs @@ -1,6 +1,5 @@ using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; +using System.Linq; using BizHawk.Common; using BizHawk.Emulation.Common; @@ -223,9 +222,30 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES // apu has some specific power up bahaviour that we will emulate here apu.NESHardReset(); - //check fceux's PowerNES and FCEU_MemoryRand function for more information: - //relevant games: Cybernoid; Minna no Taabou no Nakayoshi Daisakusen; Huang Di; and maybe mechanized attack - for(int i=0;i<0x800;i++) if((i&4)!=0) ram[i] = 0xFF; else ram[i] = 0x00; + + if (SyncSettings.InitialWRamStatePattern != null && SyncSettings.InitialWRamStatePattern.Any()) + { + for (int i = 0; i < 0x800; i++) + { + ram[i] = SyncSettings.InitialWRamStatePattern[i % SyncSettings.InitialWRamStatePattern.Count]; + } + } + else + { + // check fceux's PowerNES and FCEU_MemoryRand function for more information: + // relevant games: Cybernoid; Minna no Taabou no Nakayoshi Daisakusen; Huang Di; and maybe mechanized attack + for (int i = 0; i < 0x800; i++) + { + if ((i & 4) != 0) + { + ram[i] = 0xFF; + } + else + { + ram[i] = 0x00; + } + } + } SetupMemoryDomains(); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.ISettable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.ISettable.cs index fed992396c..ed511abec2 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.ISettable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.ISettable.cs @@ -73,6 +73,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public NESControlSettings Controls = new NESControlSettings(); + public List InitialWRamStatePattern = new List + { + 0, 0, 0, 0, 255, 255, 255, 255 + }; + public NESSyncSettings Clone() { var ret = (NESSyncSettings)MemberwiseClone();