summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorSynray <31429825+Synray@users.noreply.github.com>2020-12-11 07:58:06 -0800
committerGitHub <noreply@github.com>2020-12-11 10:58:06 -0500
commit51b204f8e1012c4a773c0d98c4536b5125b1a695 (patch)
tree7a46c033b5236048e1c624b2325b8e7fdee4a0b0 /src/code
parentd4e16bbacf2d729525618802686dc24572eeb10b (diff)
Match gfxprint.c (#520)
* Match gfxprint.c * Review changes Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
Diffstat (limited to 'src/code')
-rw-r--r--src/code/gfxprint.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/code/gfxprint.c b/src/code/gfxprint.c
index 91854f8fd..91b6b44bf 100644
--- a/src/code/gfxprint.c
+++ b/src/code/gfxprint.c
@@ -132,15 +132,13 @@ u8 sGfxPrintFontData[(16 * 256) / 2] = {
};
#define gDPSetPrimColorMod(pkt, m, l, rgba) \
- _DW({ \
+ { \
Gfx* _g = (Gfx*)(pkt); \
\
_g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \
_g->words.w1 = (rgba); \
- })
+ }
-#ifdef NON_MATCHING
-// regalloc and minor ordering differences
void GfxPrint_InitDlist(GfxPrint* this) {
s32 width = 16;
s32 height = 256;
@@ -181,7 +179,7 @@ void GfxPrint_InitDlist(GfxPrint* this) {
gDPLoadSync(this->dlist++);
gDPLoadTile(this->dlist++, G_TX_LOADTILE, 0, 0, 2, 28);
gDPPipeSync(this->dlist++);
- gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_8b, 1, 0, 1, 4, G_TX_NOMIRROR | G_TX_WRAP, 3, G_TX_NOLOD,
+ gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, 1, 4, G_TX_NOMIRROR | G_TX_WRAP, 3, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, 1, G_TX_NOLOD);
gDPSetTileSize(this->dlist++, 1, 0, 0, 4, 28);
@@ -193,9 +191,6 @@ void GfxPrint_InitDlist(GfxPrint* this) {
gDPSetTileSize(this->dlist++, i * 2 + 1, 0, 0, 4, 28);
}
}
-#else
-#pragma GLOBAL_ASM("asm/non_matchings/code/gfxprint/GfxPrint_InitDlist.s")
-#endif
void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a) {
this->color.r = r;
@@ -220,9 +215,9 @@ void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y) {
this->baseY = y << 2;
}
-#ifdef NON_MATCHING
-// regalloc and ordering differences
void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
+ u32 tile = (c & 0xFF) * 2;
+
if (this->flag & GFXPRINT_UPDATE_MODE) {
this->flag &= ~GFXPRINT_UPDATE_MODE;
@@ -245,10 +240,10 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
if (this->flag & GFXPRINT_FLAG64) {
gSPTextureRectangle(this->dlist++, (this->posX + 4) << 1, (this->posY + 4) << 1, (this->posX + 4 + 32) << 1,
- (this->posY + 4 + 32) << 1, c * 2, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 512, 512);
+ (this->posY + 4 + 32) << 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 512, 512);
} else {
gSPTextureRectangle(this->dlist++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32,
- c * 2, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
+ tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
}
gDPSetPrimColorMod(this->dlist++, 0, 0, this->color.rgba);
@@ -256,17 +251,14 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
if (this->flag & GFXPRINT_FLAG64) {
gSPTextureRectangle(this->dlist++, (this->posX) << 1, (this->posY) << 1, (this->posX + 32) << 1,
- (this->posY + 32) << 1, c * 2, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 512, 512);
+ (this->posY + 32) << 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 512, 512);
} else {
- gSPTextureRectangle(this->dlist++, this->posX, this->posY, this->posX + 32, this->posY + 32, c * 2,
+ gSPTextureRectangle(this->dlist++, this->posX, this->posY, this->posX + 32, this->posY + 32, tile,
(u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
}
this->posX += 32;
}
-#else
-#pragma GLOBAL_ASM("asm/non_matchings/code/gfxprint/GfxPrint_PrintCharImpl.s")
-#endif
void GfxPrint_PrintChar(GfxPrint* this, u8 c) {
u8 charParam = c;