MCPcopy Create free account
hub / github.com/TASEmulators/fceux / GetButtonColor

Function GetButtonColor

src/video.cpp:175–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175static uint32 GetButtonColor(uint32 held, uint32 c, uint32 ci, int bit)
176{
177 uint32 on = FCEUMOV_Mode(MOVIEMODE_PLAY) ? 0x90 : 0xA7; //Standard, or Gray depending on movie mode
178 uint32 oni = 0xA0; //Color for immediate keyboard buttons
179 uint32 blend = 0xB6; //Blend of immiate and last held buttons
180 uint32 ahold = 0x87; //Auto hold
181 uint32 off = 0xCF;
182
183 uint32 color;
184 uint8 mask = 1u << bit;
185 if (held & mask) { //If auto-hold
186 if (!(ci & mask))
187 color = ahold;
188 else
189 color = (c & mask) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
190 }
191 else {
192 if (c & mask)
193 color = (ci & mask) ? blend : on; //If immedaite buttons are pressed and they match the previous frame, blend the colors
194 else
195 color = (ci & mask) ? oni : off;
196 }
197 return color;
198}
199
200void FCEU_PutImage(void)
201{

Callers 1

FCEU_PutImageFunction · 0.85

Calls 1

FCEUMOV_ModeFunction · 0.85

Tested by

no test coverage detected