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/main.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 5e0aad1..bf30628 100644 --- a/src/main.c +++ b/src/main.c @@ -45,7 +45,7 @@ static Device *devmouse; static Mouse mouse = {SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2}; void -nil_talk(Device *d, Uint8 b0, Uint8 w) { +nil_talk(Device *d, u8 b0, u8 w) { (void)d; (void)b0; (void)w; @@ -66,50 +66,50 @@ console_talk(Device *d, u8 b0, u8 w) { } void -system_talk(Device *d, Uint8 b0, Uint8 w) { +system_talk(Device *d, u8 b0, u8 w) { if(!w) { d->dat[0x2] = d->u->wst.ptr; d->dat[0x3] = d->u->rst.ptr; } else { - putcolors(&ppu, &d->dat[0x8]); + putcolors(&d->dat[0x8]); } (void)b0; } IWRAM_CODE void -screen_talk(Device *d, Uint8 b0, Uint8 w) { +screen_talk(Device *d, u8 b0, u8 w) { if(w && b0 == 0xe) { - Uint16 x = mempeek16(d->dat, 0x8); - Uint16 y = mempeek16(d->dat, 0xa); - Uint8 *addr = &d->mem[mempeek16(d->dat, 0xc)]; - Uint8 *layer = d->dat[0xe] >> 4 & 0x1 ? ppu.fg : ppu.bg; - Uint8 mode = d->dat[0xe] >> 5; + u16 x = mempeek16(d->dat, 0x8); + u16 y = mempeek16(d->dat, 0xa); + u8 *addr = &d->mem[mempeek16(d->dat, 0xc)]; + u8 *layer = d->dat[0xe] >> 4 & 0x1 ? ppu.fg : ppu.bg; + u8 mode = d->dat[0xe] >> 5; if(!mode) { - putpixel(&ppu, layer, x, y, d->dat[0xe] & 0x3); + putpixel(layer, x, y, d->dat[0xe] & 0x3); } else if(mode-- & 0x1) { - puticn(&ppu, layer, x, y, addr, d->dat[0xe] & 0xf, mode & 0x2, mode & 0x4); + puticn(layer, x, y, addr, d->dat[0xe] & 0xf, mode & 0x2, mode & 0x4); } else { - putchr(&ppu, layer, x, y, addr, d->dat[0xe] & 0xf, mode & 0x2, mode & 0x4); + putchr(layer, x, y, addr, d->dat[0xe] & 0xf, mode & 0x2, mode & 0x4); } } } void -datetime_talk(Device *d, Uint8 b0, Uint8 w) { +datetime_talk(Device *d, u8 b0, u8 w) { (void)d; (void)b0; (void)w; } void -file_talk(Device *d, Uint8 b0, Uint8 w) { - Uint8 read = b0 == 0xd; +file_talk(Device *d, u8 b0, u8 w) { + u8 read = b0 == 0xd; if(w && (read || b0 == 0xf)) { char *name = (char *)&d->mem[mempeek16(d->dat, 0x8)]; - Uint16 result = 0, length = mempeek16(d->dat, 0xa); - Uint16 offset = mempeek16(d->dat, 0x4); - Uint16 addr = mempeek16(d->dat, b0 - 1); + u16 result = 0, length = mempeek16(d->dat, 0xa); + u16 offset = mempeek16(d->dat, 0x4); + u16 addr = mempeek16(d->dat, b0 - 1); int file_idx = fs_open_file(name, read ? OPEN_READ : OPEN_WRITE); if (file_idx >= 0) { if (read) { @@ -177,7 +177,7 @@ handle_input(Uxn *u) { if (control_method == CONTROL_CONTROLLER) { // TODO: We don't need ifs if we use KEY_INPUTS directly and mayvbe just // swap some things if needed. - Uint8 *flag = &devctrl->dat[2]; + u8 *flag = &devctrl->dat[2]; if (key_pressed(KEY_A)) { *flag |= 0x01; } else { @@ -223,7 +223,7 @@ handle_input(Uxn *u) { devctrl->dat[3] = 0; } else if (control_method == CONTROL_MOUSE) { // Detect "mouse key press". - Uint8 flag = devmouse->dat[6]; + u8 flag = devmouse->dat[6]; if (key_tap(KEY_B)) { flag |= 0x01; } else if (key_released(KEY_B)) { @@ -265,7 +265,7 @@ handle_input(Uxn *u) { static Uxn u; EWRAM_BSS -static Uint8 umem[65536]; +static u8 umem[65536]; int main(void) { // Initialize filesystem. -- cgit v1.2.1