From 94e4c2b91faa0583fdc8c0ac55e301c6c599068c Mon Sep 17 00:00:00 2001 From: dark-samus Date: Mon, 23 Mar 2020 19:44:03 -0400 Subject: fix final non-matching in fault_drawer.c --- src/code/fault_drawer.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/code') diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c index b17679d35..cc2195172 100644 --- a/src/code/fault_drawer.c +++ b/src/code/fault_drawer.c @@ -94,30 +94,33 @@ void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 col } } -#ifdef NON_MATCHING -// regalloc and minor ordering differences void FaultDrawer_DrawChar(char c) { u16* fb; s32 x, y; + s32 test; u32* dataPtr; + u32 data; s32 cursorX = sFaultDrawerStruct.cursorX; s32 cursorY = sFaultDrawerStruct.cursorY; + u32** temp = &sFaultDrawerStruct.fontData; - dataPtr = &sFaultDrawerStruct.fontData[((c & 4) >> 2) + ((c / 8) * 16)]; - fb = sFaultDrawerStruct.fb + sFaultDrawerStruct.w * cursorY + cursorX; + test = c % 4; + dataPtr = &temp[0][(((c / 8) * 16) + ((c & 4) >> 2))]; + fb = sFaultDrawerStruct.fb + (sFaultDrawerStruct.w * cursorY) + cursorX; if ((sFaultDrawerStruct.xStart <= cursorX) && ((sFaultDrawerStruct.charW + cursorX - 1) <= sFaultDrawerStruct.xEnd) && (sFaultDrawerStruct.yStart <= cursorY) && ((sFaultDrawerStruct.charH + cursorY - 1) <= sFaultDrawerStruct.yEnd)) { for (y = 0; y < sFaultDrawerStruct.charH; y++) { - u32 mask = 0x10000000 << (c % 4); - u32 data = *dataPtr; + u32 mask = 0x10000000 << test; + data = *dataPtr; for (x = 0; x < sFaultDrawerStruct.charW; x++) { - if (mask & data) + if (mask & data) { fb[x] = sFaultDrawerStruct.foreColor; - else if (sFaultDrawerStruct.backColor & 1) + } else if (sFaultDrawerStruct.backColor & 1) { fb[x] = sFaultDrawerStruct.backColor; + } mask >>= 4; } fb += sFaultDrawerStruct.w; @@ -125,9 +128,6 @@ void FaultDrawer_DrawChar(char c) { } } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/fault_drawer/FaultDrawer_DrawChar.s") -#endif s32 FaultDrawer_ColorToPrintColor(u16 color) { s32 i; -- cgit v1.2.3 From 4bbbdc39fd5e5a44511d8c21012013692f805ec4 Mon Sep 17 00:00:00 2001 From: dark-samus Date: Mon, 23 Mar 2020 20:01:52 -0400 Subject: use a better variable name --- src/code/fault_drawer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/code') diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c index cc2195172..ef7a784ae 100644 --- a/src/code/fault_drawer.c +++ b/src/code/fault_drawer.c @@ -97,15 +97,14 @@ void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 col void FaultDrawer_DrawChar(char c) { u16* fb; s32 x, y; - s32 test; u32* dataPtr; u32 data; s32 cursorX = sFaultDrawerStruct.cursorX; s32 cursorY = sFaultDrawerStruct.cursorY; - u32** temp = &sFaultDrawerStruct.fontData; + u32** fontData = &sFaultDrawerStruct.fontData; + s32 shift = c % 4; - test = c % 4; - dataPtr = &temp[0][(((c / 8) * 16) + ((c & 4) >> 2))]; + dataPtr = &fontData[0][(((c / 8) * 16) + ((c & 4) >> 2))]; fb = sFaultDrawerStruct.fb + (sFaultDrawerStruct.w * cursorY) + cursorX; if ((sFaultDrawerStruct.xStart <= cursorX) && @@ -113,7 +112,7 @@ void FaultDrawer_DrawChar(char c) { (sFaultDrawerStruct.yStart <= cursorY) && ((sFaultDrawerStruct.charH + cursorY - 1) <= sFaultDrawerStruct.yEnd)) { for (y = 0; y < sFaultDrawerStruct.charH; y++) { - u32 mask = 0x10000000 << test; + u32 mask = 0x10000000 << shift; data = *dataPtr; for (x = 0; x < sFaultDrawerStruct.charW; x++) { if (mask & data) { -- cgit v1.2.3