Added missing launcher
[mupen64plus-pandora.git] / source / mupen64plus-video-arachnoid / src / Memory.h
CommitLineData
22726e4d 1/******************************************************************************
2 * Arachnoid Graphics Plugin for Mupen64Plus
3 * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/
4 *
5 * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *****************************************************************************/
21
22#ifndef MEMORY_H_
23#define MEMORY_H_
24
25//*****************************************************************************
26//* Memory
27//! Handle RDRAM, Texture Memory and Segments
28//*****************************************************************************
29class Memory
30{
31public:
32
33 //Constructor / Destructor
34 Memory();
35 ~Memory();
36
37 //Initialize
38 bool initialize(unsigned char* RDRAM, unsigned char* DMEM);
39
40 //Get RDRAM
41
42 unsigned char* getRDRAM(int address=0) { return &m_RDRAM[address]; }
43 unsigned int* getRDRAMint32() { return (unsigned int*)m_RDRAM; }
44 unsigned int getRDRAMSize() { return m_RDRAMSize; }
45
46 //Get DMEM
47 unsigned char* getDMEM(int address=0) { return &m_DMEM[address]; }
48
49 //Get Texture memory
50 static unsigned long long* getTextureMemory(int address=0) { return &m_TMEM[address]; }
51
52 //Get Segment adress
53 unsigned int getRDRAMAddress(unsigned int segmentAddress)
54 {
55 return (m_segments[(segmentAddress >> 24) & 0x0F] + (segmentAddress & 0x00FFFFFF)) & 0x00FFFFFF;
56 }
57
58 void setSegment(unsigned int address, unsigned int value)
59 {
60 if ( address >= 16 ) {
61 //ERROR
62 return;
63 }
64
65 m_segments[address] = value;
66 }
67
68private:
69
70 unsigned char* m_RDRAM; //!< Rambus Dynamic Random Access Memory
71 unsigned char* m_DMEM; //!< RSP Data Memory
72 static unsigned long long m_TMEM[512]; //!< Texture Memory
73 unsigned int m_segments[16]; //!< Temporary memory for storing segment values
74 unsigned int m_RDRAMSize; //!< Size of RDRAM
75
76};
77
78#endif