uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 659dea48d81b13b1679e09daf35ee26548f8d843
parent f2260abed075349b96a303d8bf883c28e3dd52f8
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 22 Sep 2021 11:54:25 -0700

Renamed update_palette to set_palette

Diffstat:
Msrc/uxnemu.c | 34+++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -105,6 +105,22 @@ stdin_handler(void *p) (void)p; } +void +set_palette(Uint8 *addr) +{ + int i; + for(i = 0; i < 4; ++i) { + Uint8 + r = (*(addr + i / 2) >> (!(i % 2) << 2)) & 0x0f, + g = (*(addr + 2 + i / 2) >> (!(i % 2) << 2)) & 0x0f, + b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f; + palette[i] = 0xff000000 | (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b; + } + for(i = 4; i < 16; ++i) + palette[i] = palette[i / 4]; + reqdraw = 1; +} + static void set_inspect(Uint8 flag) { @@ -336,22 +352,6 @@ doctrl(SDL_Event *event, int z) devctrl->dat[2] &= ~flag; } -void -update_palette(Uint8 *addr) -{ - int i; - for(i = 0; i < 4; ++i) { - Uint8 - r = (*(addr + i / 2) >> (!(i % 2) << 2)) & 0x0f, - g = (*(addr + 2 + i / 2) >> (!(i % 2) << 2)) & 0x0f, - b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f; - palette[i] = 0xff000000 | (r << 20) | (r << 16) | (g << 12) | (g << 8) | (b << 4) | b; - } - for(i = 4; i < 16; ++i) - palette[i] = palette[i / 4]; - reqdraw = 1; -} - #pragma mark - Devices static int @@ -369,7 +369,7 @@ system_talk(Device *d, Uint8 b0, Uint8 w) case 0xf: return 0; } if(b0 > 0x7 && b0 < 0xe) - update_palette(&d->dat[0x8]); + set_palette(&d->dat[0x8]); } return 1; }