From 76b4e3f2df10b89902caeb2b947a96f2dc25da52 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 12 Dec 2014 01:05:32 +0100 Subject: [PATCH] And another one --- video.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 126 insertions(+), 2 deletions(-) diff --git a/video.c b/video.c index 7e4d961..1e91597 100644 --- a/video.c +++ b/video.c @@ -1333,7 +1333,69 @@ static void render_scanline_text_base_color16(u32 layer, */ /* Render a single scanline of text tiles */ - tile_render(8bpp, base, color16); + u32 vertical_pixel_offset = (vertical_offset % 8) * + tile_width_8bpp; + u32 vertical_pixel_flip = + ((tile_size_8bpp - tile_width_8bpp) - + vertical_pixel_offset) - vertical_pixel_offset; + tile_extra_variables_8bpp(); + u8 *tile_base = vram + (((bg_control >> 2) & 0x03) * (1024 * 16)) + + vertical_pixel_offset; + u32 pixel_run = 256 - (horizontal_offset % 256); + u32 current_tile; + + map_base += ((vertical_offset % 256) / 8) * 32; + partial_tile_offset = (horizontal_offset % 8); + + if(pixel_run >= end) + { + if(partial_tile_offset) + { + partial_tile_run = 8 - partial_tile_offset; + if(end < partial_tile_run) + { + partial_tile_run = end; + partial_tile_mid_map(base, 8bpp, color16); + return; + } + else + { + end -= partial_tile_run; + partial_tile_right_map(base, 8bpp, color16); + } + } + + tile_run = end / 8; + multiple_tile_map(base, 8bpp, color16); + + partial_tile_run = end % 8; + + if(partial_tile_run) + { + partial_tile_left_map(base, 8bpp, color16); + } + } + else + { + if(partial_tile_offset) + { + partial_tile_run = 8 - partial_tile_offset; + partial_tile_right_map(base, 8bpp, color16); + } + + tile_run = (pixel_run - partial_tile_run) / 8; + multiple_tile_map(base, 8bpp, color16); + map_ptr = second_ptr; + end -= pixel_run; + tile_run = end / 8; + multiple_tile_map(base, 8bpp, color16); + + partial_tile_run = end % 8; + if(partial_tile_run) + { + partial_tile_left_map(base, 8bpp, color16); + } + } } else { @@ -1343,7 +1405,69 @@ static void render_scanline_text_base_color16(u32 layer, */ /* Render a single scanline of text tiles */ - tile_render(4bpp, base, color16); + u32 vertical_pixel_offset = (vertical_offset % 8) * + tile_width_4bpp; + u32 vertical_pixel_flip = + ((tile_size_4bpp - tile_width_4bpp) - + vertical_pixel_offset) - vertical_pixel_offset; + tile_extra_variables_4bpp(); + u8 *tile_base = vram + (((bg_control >> 2) & 0x03) * (1024 * 16)) + + vertical_pixel_offset; + u32 pixel_run = 256 - (horizontal_offset % 256); + u32 current_tile; + + map_base += ((vertical_offset % 256) / 8) * 32; + partial_tile_offset = (horizontal_offset % 8); + + if(pixel_run >= end) + { + if(partial_tile_offset) + { + partial_tile_run = 8 - partial_tile_offset; + if(end < partial_tile_run) + { + partial_tile_run = end; + partial_tile_mid_map(base, 4bpp, color16); + return; + } + else + { + end -= partial_tile_run; + partial_tile_right_map(base, 4bpp, color16); + } + } + + tile_run = end / 8; + multiple_tile_map(base, 4bpp, color16); + + partial_tile_run = end % 8; + + if(partial_tile_run) + { + partial_tile_left_map(base, 4bpp, color16); + } + } + else + { + if(partial_tile_offset) + { + partial_tile_run = 8 - partial_tile_offset; + partial_tile_right_map(base, 4bpp, color16); + } + + tile_run = (pixel_run - partial_tile_run) / 8; + multiple_tile_map(base, 4bpp, color16); + map_ptr = second_ptr; + end -= pixel_run; + tile_run = end / 8; + multiple_tile_map(base, 4bpp, color16); + + partial_tile_run = end % 8; + if(partial_tile_run) + { + partial_tile_left_map(base, 4bpp, color16); + } + } } }