Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmeteor/include/ameteor/cartmem.hpp
2 views
1
// Meteor - A Nintendo Gameboy Advance emulator
2
// Copyright (C) 2009-2011 Philippe Daouadi
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
#ifndef __CART_MEM_H__
18
#define __CART_MEM_H__
19
20
#include <fstream>
21
#include <stdint.h>
22
#include <istream>
23
#include <ostream>
24
25
namespace AMeteor
26
{
27
class CartMem
28
{
29
public:
30
static const unsigned int MAX_SIZE = 0x20000;
31
32
CartMem();
33
virtual ~CartMem();
34
35
virtual void Reset () = 0;
36
37
virtual bool Load (std::istream& stream) = 0;
38
virtual bool Save (std::ostream& stream) = 0;
39
40
virtual uint8_t Read (uint16_t add) = 0;
41
// returns true if memory has been updated
42
virtual bool Write (uint16_t add, uint8_t val) = 0;
43
44
virtual bool SaveState (std::ostream& stream);
45
virtual bool LoadState (std::istream& stream);
46
47
protected:
48
uint8_t* m_data;
49
uint32_t m_size;
50
};
51
52
#ifdef __LIBRETRO__
53
extern uint8_t CartMemData[CartMem::MAX_SIZE+4];
54
#endif
55
}
56
57
#endif
58
59