Nugget
Loading...
Searching...
No Matches
control.hh
Go to the documentation of this file.
1/*
2
3MIT License
4
5Copyright (c) 2022 PCSX-Redux authors
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26
27#pragma once
28
29#include <stdint.h>
30
32
33namespace psyqo {
34
35namespace Prim {
36
37struct TPage {
38 TPage() : command(0xe100) {}
40
41 private:
42 uint16_t command;
43};
44static_assert(sizeof(TPage) == sizeof(uint32_t), "TPage is not 32 bits");
45
57 DrawingAreaStart(Vertex p) : command(0xe3000000 | p.x | (p.y << 10)) {}
58
59 private:
60 uint32_t command;
61};
62static_assert(sizeof(DrawingAreaStart) == sizeof(uint32_t), "DrawingAreaStart is not 32 bits");
63
75 DrawingAreaEnd(Vertex p) : command(0xe4000000 | (p.x - 1) | ((p.y - 1) << 10)) {}
76
77 private:
78 uint32_t command;
79};
80static_assert(sizeof(DrawingAreaEnd) == sizeof(uint32_t), "DrawingAreaEnd is not 32 bits");
81
93 DrawingOffset(Vertex p) : command(0xe5000000 | p.x | (p.y << 11)) {}
94
95 private:
96 uint32_t command;
97};
98static_assert(sizeof(DrawingOffset) == sizeof(uint32_t), "DrawingOffset is not 32 bits");
99
119 enum class Test {
120 No,
121 Yes,
122 };
123 MaskControl() : command(0xe6000000) {}
124 MaskControl(Set set, Test test) : command(0xe6000000 | set | (static_cast<uint32_t>(test) << 1)) {}
129 command &= ~0x1;
130 command |= set;
131 return *this;
132 }
134 command &= ~0x2;
135 command |= static_cast<uint32_t>(test) << 1;
136 return *this;
137 }
138 MaskControl &set(Set set, Test test) { return *this = MaskControl(set, test); }
139 MaskControl &set(Test test, Set set) { return *this = MaskControl(set, test); }
140
141 private:
142 uint32_t command;
143};
144static_assert(sizeof(MaskControl) == sizeof(uint32_t), "MaskControl is not 32 bits");
145
156struct Scissor {
158 DrawingAreaEnd end = DrawingAreaEnd(Vertex{{.x = 1024, .y = 512}});
160};
161
169 VRAMUpload() : command(0xa0000000) {}
170
171 private:
172 uint32_t command;
173
174 public:
176};
177static_assert(sizeof(VRAMUpload) == (sizeof(uint32_t) * 3), "VRAMUpload is not 96 bits");
178
179} // namespace Prim
180
181} // namespace psyqo
Definition cdrom-loader.hh:39
A primitive's tpage attribute.
Definition common.hh:158
The DrawingAreaEnd primitive.
Definition control.hh:74
DrawingAreaEnd(Vertex p)
Definition control.hh:75
The DrawingAreaStart primitive.
Definition control.hh:56
DrawingAreaStart(Vertex p)
Definition control.hh:57
The DrawingOffset primitive.
Definition control.hh:92
DrawingOffset(Vertex p)
Definition control.hh:93
The MaskControl primitive.
Definition control.hh:114
MaskControl(Set set)
Definition control.hh:126
Set
Definition control.hh:115
@ ForceSet
Definition control.hh:117
@ FromSource
Definition control.hh:116
MaskControl(Test test)
Definition control.hh:127
MaskControl & set(Set set)
Definition control.hh:128
Test
Definition control.hh:119
MaskControl(Test test, Set set)
Definition control.hh:125
MaskControl()
Definition control.hh:123
MaskControl & set(Test test)
Definition control.hh:133
MaskControl(Set set, Test test)
Definition control.hh:124
MaskControl & set(Set set, Test test)
Definition control.hh:138
MaskControl & set(Test test, Set set)
Definition control.hh:139
A compounded Scissor primitive.
Definition control.hh:156
DrawingAreaEnd end
Definition control.hh:158
DrawingAreaStart start
Definition control.hh:157
DrawingOffset offset
Definition control.hh:159
Definition control.hh:37
PrimPieces::TPageAttr attr
Definition control.hh:39
TPage()
Definition control.hh:38
Initiates a VRAM upload.
Definition control.hh:168
VRAMUpload()
Definition control.hh:169
Rect region
Definition control.hh:175
The Rect struct.
Definition common.hh:74
void uint32_t(classId, spec)
The Vertex struct.
Definition common.hh:47
int16_t x
Definition common.hh:50