From 5b6a34d8f0124fa07326a378bf7c6ae511bfef0b Mon Sep 17 00:00:00 2001 From: zeromus Date: Mon, 7 Mar 2011 19:32:54 +0000 Subject: [PATCH] [NES] restore battery functionality --- BizHawk.Emulation/Consoles/Nintendo/NES/BoardDetector.cs | 5 +++-- BizHawk.Emulation/Consoles/Nintendo/NES/Boards/SxROM.cs | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/BoardDetector.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/BoardDetector.cs index 92a39cee4d..1e6bbadd64 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/BoardDetector.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/BoardDetector.cs @@ -91,7 +91,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo case "wram": currCart.wram_size += (short)ParseSize(xmlreader.GetAttribute("size")); if (xmlreader.GetAttribute("battery") != null) - currCart.wram_battery = 1; + currCart.wram_battery = true; break; case "pad": currCart.pad_h = byte.Parse(xmlreader.GetAttribute("h")); @@ -145,7 +145,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo public short chr_size; public short prg_size; public short wram_size, vram_size; - public byte pad_h, pad_v, wram_battery, mapper; + public byte pad_h, pad_v, mapper; + public bool wram_battery; public string board_type; diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/SxROM.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/SxROM.cs index 563e24515b..00407c39e6 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/SxROM.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/SxROM.cs @@ -441,6 +441,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.Boards mmc1 = new MMC1(); prg_mask = (BoardInfo.PRG_Size / 16) - 1; chr_mask = (BoardInfo.CHR_Size / 8) - 1; + BoardInfo.Battery = cart.wram_battery; //boards that don't contain CHR rom will contain CRAM. only one size is supported; set it up if it is there. Debug.Assert(BoardInfo.CRAM_Size == 0 || BoardInfo.CRAM_Size == 8);