@@ -85,6 +85,7 @@ struct Field {
85
85
std::string bits;
86
86
std::string name;
87
87
std::string value;
88
+ bool active = true ;
88
89
};
89
90
90
91
void drawRegisterFields (const char * name, const std::vector<Field>& fields) {
@@ -131,7 +132,9 @@ void drawRegisterFields(const char* name, const std::vector<Field>& fields) {
131
132
ImGui::TextUnformatted (f.name .c_str ());
132
133
ImGui::NextColumn ();
133
134
134
- ImGui::TextUnformatted (f.value .c_str ());
135
+ ImVec4 color (1 , 1 , 1 , 1 );
136
+ if (!f.active ) color.w = 0.25 ;
137
+ ImGui::TextColored (color, f.value .c_str ());
135
138
ImGui::NextColumn ();
136
139
}
137
140
@@ -151,13 +154,23 @@ void Timers::timersWindow(System* sys) {
151
154
ImGui::Columns (3 );
152
155
for (auto * timer : timers) {
153
156
int which = timer->which ;
157
+ const bool syncEnabled = timer->mode .syncEnabled ;
158
+ const bool resetAfterTarget = timer->mode .resetToZero == timer::CounterMode::ResetToZero::whenTarget;
159
+ const bool irqWhenTarget = timer->mode .irqWhenTarget ;
160
+ const bool irqOneShot = timer->mode .irqRepeatMode == timer::CounterMode::IrqRepeatMode::oneShot;
161
+ const bool irqPulseMode = timer->mode .irqPulseMode == timer::CounterMode::IrqPulseMode::shortPulse;
162
+ const auto clockSource = getClockSource (timer);
163
+
154
164
ImGui::Text (" Timer%d" , which);
155
165
ImGui::Text (" Value: 0x%04x" , timer->current ._reg );
156
166
if (ImGui::IsItemHovered ()) {
157
167
ImGui::SetTooltip (" 0x%08x" , timer->baseAddress + which * 0x10 + 0 );
158
168
}
159
169
160
- ImGui::Text (" Target: 0x%04x" , timer->target ._reg );
170
+ ImVec4 color (1 , 1 , 1 , 1 );
171
+ if (!irqWhenTarget && !resetAfterTarget) color.w = 0.25 ;
172
+
173
+ ImGui::TextColored (color, " Target: 0x%04x" , timer->target ._reg );
161
174
if (ImGui::IsItemHovered ()) {
162
175
ImGui::SetTooltip (" 0x%08x" , timer->baseAddress + which * 0x10 + 8 );
163
176
}
@@ -168,18 +181,17 @@ void Timers::timersWindow(System* sys) {
168
181
}
169
182
170
183
const std::vector<Field> fields = {
171
- {" 0" , " Sync" , timer->mode .syncEnabled ? " On" : " Off" },
172
- {" 1-2" , " SyncMode" , getSyncMode (timer)},
173
- {" 3" , " Reset counter" , timer->mode .resetToZero == timer::CounterMode::ResetToZero::whenFFFF ? " after 0xffff" : " after target" },
174
- {" 4" , " IRQ on target" , timer->mode .irqWhenTarget ? " On" : " Off" },
175
- {" 5" , " IRQ on 0xFFFF" , timer->mode .irqWhenFFFF ? " On" : " Off" },
176
- {" 6" , " IRQ repeat mode" ,
177
- timer->mode .irqRepeatMode == timer::CounterMode::IrqRepeatMode::repeatedly ? " Repeatedly" : " One-shot" },
178
- {" 7" , " IRQ pulse mode" , timer->mode .irqPulseMode == timer::CounterMode::IrqPulseMode::toggle ? " Toggle bit10" : " Pulse bit10" },
179
- {" 8-9" , " Clock source" , getClockSource (timer)},
180
- {" 10" , " IRQ request" , timer->mode .interruptRequest ? " No" : " Pending" },
181
- {" 11" , " Reached target" , timer->mode .reachedTarget ? " Yes" : " No" },
182
- {" 12" , " Reached 0xFFFF" , timer->mode .reachedFFFF ? " Yes" : " No" },
184
+ {" 0" , " Sync" , syncEnabled ? " On" : " Off" , syncEnabled},
185
+ {" 1-2" , " SyncMode" , getSyncMode (timer), syncEnabled},
186
+ {" 3" , " Reset counter" , resetAfterTarget ? " after target" : " after 0xffff" , resetAfterTarget},
187
+ {" 4" , " IRQ on target" , timer->mode .irqWhenTarget ? " On" : " Off" , (bool )timer->mode .irqWhenTarget },
188
+ {" 5" , " IRQ on 0xFFFF" , timer->mode .irqWhenFFFF ? " On" : " Off" , (bool )timer->mode .irqWhenFFFF },
189
+ {" 6" , " IRQ repeat mode" , irqOneShot ? " One-shot" : " Repeatedly" , !irqOneShot},
190
+ {" 7" , " IRQ pulse mode" , irqPulseMode ? " Pulse bit10" : " Toggle bit10" , !irqPulseMode},
191
+ {" 8-9" , " Clock source" , clockSource, clockSource.compare (" Sysclock" ) != 0 },
192
+ {" 10" , " IRQ request" , timer->mode .interruptRequest ? " No" : " Pending" , (bool )!timer->mode .interruptRequest },
193
+ {" 11" , " Reached target" , timer->mode .reachedTarget ? " Yes" : " No" , (bool )timer->mode .reachedTarget },
194
+ {" 12" , " Reached 0xFFFF" , timer->mode .reachedFFFF ? " Yes" : " No" , (bool )timer->mode .reachedFFFF },
183
195
};
184
196
185
197
drawRegisterFields (string_format (" flags##timer%d" , which).c_str (), fields);
0 commit comments