aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneonloop2021-04-04 16:03:56 +0000
committerneonloop2021-04-04 16:03:56 +0000
commitdd9f73b910a3c1effba8558b5539c23b44224bda (patch)
tree06ceda8eaead25afa746a51557ce7852e49a3bfe
parent67c4ecd9a17491c102cdc8e5d08b22ab422826c8 (diff)
downloadpcsx_rearmed-dd9f73b910a3c1effba8558b5539c23b44224bda.tar.gz
pcsx_rearmed-dd9f73b910a3c1effba8558b5539c23b44224bda.tar.bz2
pcsx_rearmed-dd9f73b910a3c1effba8558b5539c23b44224bda.zip
Use correct length for cspace_buf writes
-rw-r--r--frontend/plat_trimui.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/frontend/plat_trimui.c b/frontend/plat_trimui.c
index 1042704..fc52cd4 100644
--- a/frontend/plat_trimui.c
+++ b/frontend/plat_trimui.c
@@ -218,7 +218,8 @@ static void blit320_256(unsigned char *dst8, const unsigned char *src8, int unus
unsigned char *conv = (unsigned char *)cspace_buf; \
unsigned char *dst = (unsigned char *)screen->pixels + dst_offset_y * 320; \
unsigned char *buf = (scale ? conv : dst) + dst_offset_x; \
- int dst_stride = 640; \
+ int buf_stride = scale ? 640 * sizeof(uint16_t) : 320 * sizeof(uint16_t); \
+ int dst_stride = 320 * sizeof(uint16_t); \
int len = w * psx_bpp / 8; \
int i; \
void (*convertfunc)(void *dst, const void *src, int bytes); \
@@ -227,12 +228,12 @@ static void blit320_256(unsigned char *dst8, const unsigned char *src8, int unus
SDL_LockSurface(screen); \
vram += psx_offset_y * 1024 + psx_offset_x; \
\
- for (i = h; i > 0; i--, vram += psx_step * 1024, buf += dst_stride) { \
+ for (i = h; i > 0; i--, vram += psx_step * 1024, buf += buf_stride) { \
convertfunc(buf, vram, len); \
} \
\
if (scale) { \
- for (i = h; i > 0; i--, dst += dst_stride, conv += dst_stride) { \
+ for (i = h; i > 0; i--, dst += dst_stride, conv += buf_stride) { \
blitfunc(dst, conv, dst_stride); \
} \
} \