X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=boards%2F199.c;fp=boards%2F199.c;h=3302dc6a8b958e5b2d61c5c46fc817619da7718e;hp=ed21278a9a1dedc3486087c48e299504a678959c;hb=43725da7349c85fa13e828fdbf20cc7ac8d298d6;hpb=386f5371eb984fb9c2860c83e740890a75cd45c1 diff --git a/boards/199.c b/boards/199.c index ed21278..3302dc6 100644 --- a/boards/199.c +++ b/boards/199.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Dragon Ball Z 2 - Gekishin Freeza! (C) * Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C) @@ -26,7 +26,8 @@ #include "mapinc.h" #include "mmc3.h" -static uint8 *CHRRAM=NULL; // and here too +static uint8 *CHRRAM=NULL; +static uint32 CHRRAMSIZE; static void M199PW(uint32 A, uint8 V) { @@ -60,7 +61,6 @@ static DECLFW(M199Write) { if((A==0x8001)&&(MMC3_cmd&8)) { -// FCEU_printf("%02x=>%02x\n",MMC3_cmd,V); EXPREGS[MMC3_cmd&3]=V; FixMMC3PRG(MMC3_cmd); FixMMC3CHR(MMC3_cmd); @@ -82,16 +82,26 @@ static void M199Power(void) SetWriteHandler(0x8000,0xFFFF,M199Write); } +static void M199Close(void) +{ + if(CHRRAM) + FCEU_gfree(CHRRAM); + CHRRAM=NULL; +} + void Mapper199_Init(CartInfo *info) { - int CHRRAMSize=1024*8; GenMMC3_Init(info, 512, 256, 8, info->battery); cwrap=M199CW; pwrap=M199PW; mwrap=M199MW; info->Power=M199Power; - CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSize); - SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSize, 1); - AddExState(CHRRAM, CHRRAMSize, 0, "CHRR"); + info->Close=M199Close; + + CHRRAMSIZE=8192; + CHRRAM=(uint8*)FCEU_gmalloc(CHRRAMSIZE); + SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); + AddExState(CHRRAM, CHRRAMSIZE, 0, "CHRR"); + AddExState(EXPREGS, 4, 0, "EXPR"); }