// Meteor - A Nintendo Gameboy Advance emulator1// Copyright (C) 2009-2011 Philippe Daouadi2//3// This program is free software: you can redistribute it and/or modify4// it under the terms of the GNU General Public License as published by5// the Free Software Foundation, either version 3 of the License, or6// (at your option) any later version.7//8// This program is distributed in the hope that it will be useful,9// but WITHOUT ANY WARRANTY; without even the implied warranty of10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11// GNU General Public License for more details.12//13// You should have received a copy of the GNU General Public License14// along with this program. If not, see <http://www.gnu.org/licenses/>.1516#include "ameteor/cartmem.hpp"17#include "globals.hpp"1819namespace AMeteor20{21#ifdef __LIBRETRO__22uint8_t CartMemData[CartMem::MAX_SIZE+4];23#endif2425CartMem::CartMem() :26#ifdef __LIBRETRO__27m_data(CartMemData)28#else29m_data(new uint8_t[MAX_SIZE+4])30#endif31{32}3334CartMem::~CartMem()35{36#ifndef __LIBRETRO__37delete [] m_data;38#endif39}4041bool CartMem::SaveState (std::ostream& stream)42{43stream.write((char*)m_data, MAX_SIZE);44SS_WRITE_VAR(m_size);4546return true;47}4849bool CartMem::LoadState (std::istream& stream)50{51stream.read((char*)m_data, MAX_SIZE);52SS_READ_VAR(m_size);5354return true;55}56}575859