From 27472e8acf860d981425a751a4e92343ccdf387a Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sun, 23 May 2021 14:33:33 +0200 Subject: Normalize the fixed int typedefs --- src/uxn/devices/ppu.c | 50 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'src/uxn/devices/ppu.c') diff --git a/src/uxn/devices/ppu.c b/src/uxn/devices/ppu.c index 4db8c77..02267f0 100644 --- a/src/uxn/devices/ppu.c +++ b/src/uxn/devices/ppu.c @@ -20,7 +20,7 @@ WITH REGARD TO THIS SOFTWARE. #define BG_BACK ((u32*)(MEM_VRAM + KB(64))) #define TILE_MAP ((u32*)(MEM_VRAM + KB(40))) -static Uint32 unpack_icon_lut[256] = { +static u32 unpack_icon_lut[256] = { 0x00000000, 0x00000001, 0x00000010, 0x00000011, 0x00000100, 0x00000101, 0x00000110, 0x00000111, 0x00001000, 0x00001001, 0x00001010, 0x00001011, 0x00001100, 0x00001101, 0x00001110, @@ -75,7 +75,7 @@ static Uint32 unpack_icon_lut[256] = { 0x11111111 }; -static Uint32 unpack_icon_lut_flipx[256] = { +static u32 unpack_icon_lut_flipx[256] = { 0x00000000, 0x10000000, 0x01000000, 0x11000000, 0x00100000, 0x10100000, 0x01100000, 0x11100000, 0x00010000, 0x10010000, 0x01010000, 0x11010000, 0x00110000, 0x10110000, 0x01110000, @@ -133,10 +133,10 @@ static Uint32 unpack_icon_lut_flipx[256] = { static u32 dirty_tiles[21] = {0}; void -putcolors(Ppu *p, Uint8 *addr) { +putcolors(u8 *addr) { int i; for(i = 0; i < 4; ++i) { - Uint8 + u8 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; @@ -145,12 +145,11 @@ putcolors(Ppu *p, Uint8 *addr) { (g << 1) | (g >> 3), (b << 1) | (b >> 3)); } - (void)p; } IWRAM_CODE void -putpixel(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 color) { +putpixel(u32 *layer, u16 x, u16 y, u8 color) { if (x >= SCREEN_WIDTH || y >= SCREEN_HEIGHT) return; size_t tile_x = x / 8; size_t tile_y = y / 8; @@ -160,20 +159,19 @@ putpixel(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 color) { size_t shift = start_col * 4; layer[pos] = (layer[pos] & (~(0xF << shift))) | (color << shift); dirty_tiles[tile_y] |= 1 << tile_x; - (void)p; } IWRAM_CODE void -puticn(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy) { - Uint8 sprline; - Uint16 v; - Uint32 dirtyflag = (1 << (x >> 3)) | (1 << ((x + 7) >> 3)); +puticn(u32 *layer, u16 x, u16 y, u8 *sprite, u8 color, u8 flipx, u8 flipy) { + u8 sprline; + u16 v; + u32 dirtyflag = (1 << (x >> 3)) | (1 << ((x + 7) >> 3)); - Uint32 layerpos = ((y & 7) + (((x >> 3) + (y >> 3) * 32) * 8)); - Uint32 *layerptr = &layer[layerpos]; - Uint32 shift = (x & 7) << 2; - Uint32 *lut_expand = flipx ? unpack_icon_lut : unpack_icon_lut_flipx; + u32 layerpos = ((y & 7) + (((x >> 3) + (y >> 3) * 32) * 8)); + u32 *layerptr = &layer[layerpos]; + u32 shift = (x & 7) << 2; + u32 *lut_expand = flipx ? unpack_icon_lut : unpack_icon_lut_flipx; if (flipy) flipy = 7; @@ -211,21 +209,20 @@ puticn(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Ui dirty_tiles[y >> 3] |= dirtyflag; dirty_tiles[(y + 7) >> 3] |= dirtyflag; - (void)p; } IWRAM_CODE void -putchr(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, - Uint8 flipx, Uint8 flipy) { - Uint8 sprline1, sprline2; - Uint16 v; - Uint32 dirtyflag = (1 << (x >> 3)) | (1 << ((x + 7) >> 3)); +putchr(u32 *layer, u16 x, u16 y, u8 *sprite, u8 color, + u8 flipx, u8 flipy) { + u8 sprline1, sprline2; + u16 v; + u32 dirtyflag = (1 << (x >> 3)) | (1 << ((x + 7) >> 3)); - Uint32 layerpos = ((y & 7) + (((x >> 3) + (y >> 3) * 32) * 8)); - Uint32 *layerptr = &layer[layerpos]; - Uint32 shift = (x & 7) << 2; - Uint32 *lut_expand = flipx ? unpack_icon_lut : unpack_icon_lut_flipx; + u32 layerpos = ((y & 7) + (((x >> 3) + (y >> 3) * 32) * 8)); + u32 *layerptr = &layer[layerpos]; + u32 shift = (x & 7) << 2; + u32 *lut_expand = flipx ? unpack_icon_lut : unpack_icon_lut_flipx; if (flipy) flipy = 7; @@ -254,7 +251,6 @@ putchr(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, dirty_tiles[y >> 3] |= dirtyflag; dirty_tiles[(y + 7) >> 3] |= dirtyflag; - (void)p; } IWRAM_CODE @@ -281,7 +277,7 @@ flipbuf(Ppu *p) { } int -initppu(Ppu *p, Uint8 hor, Uint8 ver, Uint8 pad) { +initppu(Ppu *p, u8 hor, u8 ver, u8 pad) { p->hor = hor; p->ver = ver; p->pad = pad; -- cgit v1.2.1