mirror of
https://github.com/DarkStore-3DS/Universal-Core.git
synced 2026-07-02 16:59:05 +00:00
Fix tonccpy missing last byte in DS mode
Cleanup in image.cpp is unrelated
This commit is contained in:
+3
-4
@@ -88,15 +88,14 @@ void Image::draw(int x, int y, bool top, int layer, bool copyPal) {
|
||||
if(copyPal)
|
||||
tonccpy((top ? BG_PALETTE : BG_PALETTE_SUB) + _palOfs, _palette.data(), _palette.size() * 2);
|
||||
|
||||
u8 *dst = (u8 *)bgGetGfxPtr(top ? layer : layer + 4);
|
||||
int width = 256;
|
||||
u8 *dst = (u8 *)bgGetGfxPtr(top ? layer : layer + 4) + y * 256 + x;
|
||||
|
||||
// If full width and X is 0, copy it all in one go
|
||||
if(_width == width && x == 0) {
|
||||
if(_width == 256 && x == 0) {
|
||||
tonccpy(dst, _bitmap.data(), _width * _height);
|
||||
} else {
|
||||
for(int i = 0; i < _height; i++) {
|
||||
tonccpy(dst + (y + i) * 256 + x, _bitmap.data() + i * _width, _width);
|
||||
tonccpy(dst + i * 256, _bitmap.data() + i * _width, _width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -70,8 +70,10 @@ void tonccpy(void *dst, const void *src, uint size) {
|
||||
}
|
||||
|
||||
// Tail: 1 byte.
|
||||
if(size & 1)
|
||||
*dst16 = (*dst16 & ~0xFF) | *src8;
|
||||
if(size & 1) {
|
||||
*dst16 &= ~0xFF;
|
||||
*dst16 |= *src8;
|
||||
}
|
||||
}
|
||||
//# toncset.c
|
||||
|
||||
|
||||
Reference in New Issue
Block a user