Skip to content

Commit

Permalink
fix manual texture mirroring
Browse files Browse the repository at this point in the history
fixes #10
  • Loading branch information
fgsfdsfgs committed Sep 29, 2020
1 parent d700400 commit 18d8919
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pc/gfx/gfx_pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ static void import_texture_ia8(int tile) {
const uint32_t height = (rdp.texture_tile.cmt & G_TX_MIRROR) ? orig_height * 2 : orig_height;
const uint8_t src_stride = orig_width;

register uint32_t src, dst = 0, src_base, x;
register uint32_t src, dst = 0, src_base = 0, x;

for (uint32_t y = 0; y < height; ++y) {
src = src_base;
Expand All @@ -458,6 +458,7 @@ static void import_texture_ia8(int tile) {
rgba32_buf[dst + 2] = SCALE_4_8(b);
rgba32_buf[dst + 3] = GFX_TEXALPHA_CONV(alpha);
}
--src;
for (x = orig_width; x < width; ++x, dst += 4, --src) {
uint8_t intensity = rdp.loaded_texture[tile].addr[src] >> 4;
uint8_t alpha = rdp.loaded_texture[tile].addr[src] & 0xf;
Expand All @@ -470,8 +471,8 @@ static void import_texture_ia8(int tile) {
rgba32_buf[dst + 2] = SCALE_4_8(b);
rgba32_buf[dst + 3] = GFX_TEXALPHA_CONV(alpha);
}
if (y < orig_height) src_base += src_stride;
else src_base -= src_stride;
if (y < orig_height - 1) src_base += src_stride;
else if (y >= orig_height) src_base -= src_stride;
}
#else
for (uint32_t i = 0; i < rdp.loaded_texture[tile].size_bytes; i++) {
Expand Down

0 comments on commit 18d8919

Please sign in to comment.