Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmeteor/source/cartmem.cpp
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
#include "ameteor/cartmem.hpp"
18
#include "globals.hpp"
19
20
namespace AMeteor
21
{
22
#ifdef __LIBRETRO__
23
uint8_t CartMemData[CartMem::MAX_SIZE+4];
24
#endif
25
26
CartMem::CartMem() :
27
#ifdef __LIBRETRO__
28
m_data(CartMemData)
29
#else
30
m_data(new uint8_t[MAX_SIZE+4])
31
#endif
32
{
33
}
34
35
CartMem::~CartMem()
36
{
37
#ifndef __LIBRETRO__
38
delete [] m_data;
39
#endif
40
}
41
42
bool CartMem::SaveState (std::ostream& stream)
43
{
44
stream.write((char*)m_data, MAX_SIZE);
45
SS_WRITE_VAR(m_size);
46
47
return true;
48
}
49
50
bool CartMem::LoadState (std::istream& stream)
51
{
52
stream.read((char*)m_data, MAX_SIZE);
53
SS_READ_VAR(m_size);
54
55
return true;
56
}
57
}
58
59