summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2020-11-27 11:10:03 -0500
committerGitHub <noreply@github.com>2020-11-27 11:10:03 -0500
commit571c5988ecf178ae47aa25ea95e2fc9dc17e1168 (patch)
tree3e395bd83ede02ca6b038f11a0daaddde21b8d3f /src
parent7b1fee32397f787a30d914ecc54c068444209b27 (diff)
parent54becd2303fa25db7e0db42525f44acc964c03e3 (diff)
Merge pull request #1257 from Kurausukun/menu_nonmatching
[LEAK INFORMED] match sub_819A080
Diffstat (limited to 'src')
-rw-r--r--src/menu.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/menu.c b/src/menu.c
index dca8adc2d..4813f7b02 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -2016,7 +2016,7 @@ void sub_819A080(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 src
{
int loopSrcY, loopDstY, loopSrcX, loopDstX, xEnd, yEnd, multiplierSrcY, multiplierDstY;
const u8 *pixelsSrc;
- u16 *pixelsDst;
+ u8 *pixelsDst;
u16 toOrr;
if (dst->width - dstX < width)
@@ -2037,53 +2037,52 @@ void sub_819A080(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 src
for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++)
{
pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1B);
- pixelsDst = (void*) dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + ((( loopDstY >> 3) * multiplierDstY) << 5) + ((u32)( loopDstY << 0x1d) >> 0x1B);
+ pixelsDst = (void*) dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + ((( loopDstY >> 3) * multiplierDstY) << 5) + ((u32)(loopDstY << 0x1d) >> 0x1B);
- if ((uintptr_t )pixelsDst & 0x1)
+ if ((uintptr_t)pixelsDst & 0x1)
{
- pixelsDst = (void*)(pixelsDst) - 1;
+ pixelsDst--;
if (loopDstX & 0x1)
{
- toOrr = *pixelsDst & 0x0fff;
+ toOrr = *(vu16*)pixelsDst;
+ toOrr &= 0x0fff;
if (loopSrcX & 0x1)
- *pixelsDst = toOrr | ((*pixelsSrc & 0xf0) << 8);
+ toOrr |= ((*pixelsSrc & 0xf0) << 8);
else
- *pixelsDst = toOrr | ((*pixelsSrc & 0x0f) << 12);
+ toOrr |= ((*pixelsSrc & 0x0f) << 12);
}
else
{
- toOrr = *pixelsDst & 0xf0ff;
+ toOrr = *(vu16*)pixelsDst;
+ toOrr &= 0xf0ff;
if (loopSrcX & 0x1)
- *pixelsDst = toOrr | ((*pixelsSrc & 0xf0) << 4);
+ toOrr |= ((*pixelsSrc & 0xf0) << 4);
else
- *pixelsDst = toOrr | ((*pixelsSrc & 0x0f) << 8);
+ toOrr |= ((*pixelsSrc & 0x0f) << 8);
}
}
else
{
if (loopDstX & 1)
{
- toOrr = *pixelsDst & 0xff0f;
+ toOrr = *(vu16*)pixelsDst;
+ toOrr &= 0xff0f;
if (loopSrcX & 1)
- *pixelsDst = toOrr | ((*pixelsSrc & 0xf0) << 0);
+ toOrr |= ((*pixelsSrc & 0xf0) << 0);
else
- *pixelsDst = toOrr | ((*pixelsSrc & 0x0f) << 4);
+ toOrr |= ((*pixelsSrc & 0x0f) << 4);
}
else
{
- toOrr = *pixelsDst & 0xfff0;
+ toOrr = *(vu16*)pixelsDst;
+ toOrr &= 0xfff0;
if (loopSrcX & 1)
- *pixelsDst = toOrr | ((*pixelsSrc & 0xf0) >> 4);
+ toOrr |= ((*pixelsSrc & 0xf0) >> 4);
else
- *pixelsDst = toOrr | ((*pixelsSrc & 0x0f) >> 0);
+ toOrr |= ((*pixelsSrc & 0x0f) >> 0);
}
}
-
- // Needed to match, urgh.
- #ifndef NONMATCHING
- asm("":::"r4");
- pixelsDst++;pixelsDst--;
- #endif // NONMATCHING
+ *(vu16*)pixelsDst = toOrr;
}
}
}