// 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#ifndef __CART_MEM_H__17#define __CART_MEM_H__1819#include <fstream>20#include <stdint.h>21#include <istream>22#include <ostream>2324namespace AMeteor25{26class CartMem27{28public:29static const unsigned int MAX_SIZE = 0x20000;3031CartMem();32virtual ~CartMem();3334virtual void Reset () = 0;3536virtual bool Load (std::istream& stream) = 0;37virtual bool Save (std::ostream& stream) = 0;3839virtual uint8_t Read (uint16_t add) = 0;40// returns true if memory has been updated41virtual bool Write (uint16_t add, uint8_t val) = 0;4243virtual bool SaveState (std::ostream& stream);44virtual bool LoadState (std::istream& stream);4546protected:47uint8_t* m_data;48uint32_t m_size;49};5051#ifdef __LIBRETRO__52extern uint8_t CartMemData[CartMem::MAX_SIZE+4];53#endif54}5556#endif575859