Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmeteor/include/ameteor/lcd.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 __LCD_H__
18
#define __LCD_H__
19
20
#include "clock.hpp"
21
22
#include "memory.hpp"
23
#include "io.hpp"
24
#include "graphics/screen.hpp"
25
26
#include <stdint.h>
27
#include <istream>
28
#include <ostream>
29
30
#include <syg/signal.hpp>
31
32
namespace AMeteor
33
{
34
class Lcd
35
{
36
public :
37
Lcd ();
38
39
void Reset ();
40
41
const uint16_t* GetSurface () const
42
{
43
return m_screen.GetSurface();
44
}
45
46
Graphics::Screen& GetScreen()
47
{
48
return m_screen;
49
}
50
const Graphics::Screen& GetScreen() const
51
{
52
return m_screen;
53
}
54
55
void SetFrameskip (uint8_t skip)
56
{
57
m_screen.SetFrameskip(skip);
58
}
59
60
void UpdateDispCnt (uint16_t dispcnt)
61
{
62
m_screen.UpdateDispCnt(dispcnt);
63
}
64
65
#define UPDATE_BG_CNT(num) \
66
void UpdateBg##num##Cnt (uint16_t cnt) \
67
{ \
68
m_screen.UpdateBg##num##Cnt(cnt); \
69
}
70
UPDATE_BG_CNT(0)
71
UPDATE_BG_CNT(1)
72
UPDATE_BG_CNT(2)
73
UPDATE_BG_CNT(3)
74
#undef UPDATE_BG_CNT
75
76
#define UPDATE_BG_OFF(num, coord) \
77
void UpdateBg##num##coord##Off (uint16_t cnt) \
78
{ \
79
m_screen.UpdateBg##num##coord##Off(cnt); \
80
}
81
UPDATE_BG_OFF(0, X)
82
UPDATE_BG_OFF(0, Y)
83
UPDATE_BG_OFF(1, X)
84
UPDATE_BG_OFF(1, Y)
85
UPDATE_BG_OFF(2, X)
86
UPDATE_BG_OFF(2, Y)
87
UPDATE_BG_OFF(3, X)
88
UPDATE_BG_OFF(3, Y)
89
#undef UPDATE_BG_OFF
90
91
#define UPDATE_BG_REF(num, coord) \
92
void UpdateBg##num##Ref##coord (int32_t cnt) \
93
{ \
94
m_screen.UpdateBg##num##Ref##coord (cnt); \
95
}
96
UPDATE_BG_REF(2, X)
97
UPDATE_BG_REF(2, Y)
98
UPDATE_BG_REF(3, X)
99
UPDATE_BG_REF(3, Y)
100
#undef UPDATE_BG_REF
101
102
void OamWrite (uint32_t begin, uint32_t end)
103
{
104
m_screen.OamWrite(begin, end);
105
}
106
void OamWrite16 (uint32_t add)
107
{
108
m_screen.OamWrite16(add);
109
}
110
void OamWrite32 (uint32_t add)
111
{
112
m_screen.OamWrite32(add);
113
}
114
115
bool SaveState (std::ostream& stream);
116
bool LoadState (std::istream& stream);
117
118
//syg::signal<void> sig_vblank;
119
120
private :
121
Graphics::Screen m_screen;
122
123
void TimeEvent ();
124
125
friend void Clock::Commit();
126
};
127
}
128
129
#endif
130
131