Nugget
Loading...
Searching...
No Matches
configuration.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
31 if (resolution == Resolution::W368) {
32 config.hResolution = HR_EXTENDED;
33 config.hResolutionExtended = HRE_368;
34 } else {
35 config.hResolutionExtended = HRE_NORMAL;
36 switch (resolution) {
38 config.hResolution = HR_256;
39 break;
41 config.hResolution = HR_320;
42 break;
44 config.hResolution = HR_512;
45 break;
47 config.hResolution = HR_640;
48 break;
49 }
50 }
51 return *this;
52 }
54 switch (videoMode) {
55 case VideoMode::AUTO:
56 config.videoMode = (*((char *)0xbfc7ff52) == 'E') ? VM_PAL : VM_NTSC;
57 break;
58 case VideoMode::NTSC:
59 config.videoMode = VM_NTSC;
60 break;
61 case VideoMode::PAL:
62 config.videoMode = VM_PAL;
63 break;
64 }
65 return *this;
66 }
68 switch (colorMode) {
70 config.colorDepth = CD_15BITS;
71 break;
73 config.colorDepth = CD_24BITS;
74 break;
75 }
76 return *this;
77 }
79 config.videoInterlace = interlace == Interlace::INTERLACED ? VI_ON : VI_OFF;
80 config.vResolution = interlace == Interlace::INTERLACED ? VR_480 : VR_240;
81 return *this;
82 }
84 switch (setting) {
86 clearVRAM = true;
87 break;
89 clearVRAM = false;
90 break;
91 }
92 return *this;
93 }
94
95 private:
96 enum HResolution {
97 HR_EXTENDED,
98 HR_256 = 0,
99 HR_320 = 1,
100 HR_512 = 2,
101 HR_640 = 3,
102 };
103
104 enum VResolution {
105 VR_240 = 0,
106 VR_480 = 1,
107 };
108
109 enum VMode {
110 VM_NTSC = 0,
111 VM_PAL = 1,
112 };
113
114 enum ColorDepth {
115 CD_15BITS = 0,
116 CD_24BITS = 1,
117 };
118
119 enum VideoInterlace {
120 VI_OFF = 0,
121 VI_ON = 1,
122 };
123
125 HRE_NORMAL = 0,
126 HRE_368 = 1,
127 };
128
129 struct DisplayModeConfig {
130 enum HResolution hResolution;
131 enum VResolution vResolution;
132 enum VMode videoMode;
133 enum ColorDepth colorDepth;
134 enum VideoInterlace videoInterlace;
135 enum HResolutionExtended hResolutionExtended;
136 };
137
138 DisplayModeConfig config = {};
139 bool clearVRAM = true;
140
141 friend class GPU;
142};
The singleton GPU class.
Definition gpu.hh:88
Interlace
Definition gpu.hh:106
MiscSetting
Definition gpu.hh:107
ColorMode
Definition gpu.hh:105
Resolution
Definition gpu.hh:103
VideoMode
Definition gpu.hh:104
HResolutionExtended
Definition gpu.h:61
VResolution
Definition gpu.h:41
HResolution
Definition gpu.h:33
VideoInterlace
Definition gpu.h:56
ColorDepth
Definition gpu.h:51
Definition gpu.h:66
Definition configuration.hh:29
Configuration & set(VideoMode videoMode)
Definition configuration.hh:53
Configuration & set(Resolution resolution)
Definition configuration.hh:30
Configuration & set(Interlace interlace)
Definition configuration.hh:78
Configuration & set(MiscSetting setting)
Definition configuration.hh:83
Configuration & set(ColorMode colorMode)
Definition configuration.hh:67