mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
sms, add fast renderer, remove 1st column (8 px) if blanked
This commit is contained in:
parent
23e4719638
commit
96948bdfc8
15 changed files with 454 additions and 181 deletions
|
@ -6,6 +6,8 @@
|
|||
* See COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
// Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0
|
||||
// to 00000000 rrr00000 ggg00000 bbb00000 ...
|
||||
// TODO: rm when gp2x/emu.c is no longer used
|
||||
|
@ -52,40 +54,88 @@ void bgr444_to_rgb32_sh(void *to, void *from)
|
|||
}
|
||||
}
|
||||
|
||||
void vidcpy_m2(void *dest, void *src, int m32col, int with_32c_border)
|
||||
#define X (x_y >> 16)
|
||||
#define Y (x_y & 0xffff)
|
||||
#define W (w_h >> 16)
|
||||
#define H (w_h & 0xffff)
|
||||
|
||||
// gp2x: 0-> X wiz: Y <-0
|
||||
// | |
|
||||
// v v
|
||||
//
|
||||
// Y X
|
||||
|
||||
void vidcpy_8bit(void *dest, void *src, int x_y, int w_h)
|
||||
{
|
||||
unsigned char *pd = dest, *ps = src;
|
||||
int i;
|
||||
|
||||
pd += X + Y*320;
|
||||
ps += X + Y*328 + 8;
|
||||
for (i = 0; i < H; i++) {
|
||||
memcpy(pd, ps, W);
|
||||
ps += 328; pd += 320;
|
||||
}
|
||||
}
|
||||
|
||||
void vidcpy_8bit_rot(void *dest, void *src, int x_y, int w_h)
|
||||
{
|
||||
unsigned char *pd = dest, *ps = src;
|
||||
int i, u;
|
||||
|
||||
if (m32col) {
|
||||
for (i = 0; i < 224; i++)
|
||||
{
|
||||
ps += 8;
|
||||
ps += 32;
|
||||
pd += 32;
|
||||
for (u = 0; u < 256; u++)
|
||||
*pd++ = *ps++;
|
||||
ps += 32;
|
||||
pd += 32;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 224; i++)
|
||||
{
|
||||
ps += 8;
|
||||
for (u = 0; u < 320; u++)
|
||||
*pd++ = *ps++;
|
||||
pd += Y + (319-X)*240;
|
||||
ps += X + Y*328 + 8;
|
||||
for (i = 0; i < H; i += 4) {
|
||||
unsigned char *p = (void *)ps;
|
||||
unsigned int *q = (void *)pd;
|
||||
for (u = 0; u < W; u++) {
|
||||
*q = (p[3*328]<<24) + (p[2*328]<<16) + (p[1*328]<<8) + p[0*328];
|
||||
p += 1;
|
||||
q -= 240/4;
|
||||
}
|
||||
ps += 4*328; pd += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void vidcpy_m2_rot(void *dest, void *src, int m32col, int with_32c_border)
|
||||
{
|
||||
}
|
||||
|
||||
void rotated_blit8 (void *dst, void *linesx4, int y, int is_32col)
|
||||
{
|
||||
unsigned char *pd = dst, *ps = linesx4;
|
||||
int x, w, u;
|
||||
|
||||
x = (is_32col ? 32 : 0);
|
||||
w = (is_32col ? 256 : 320);
|
||||
y -= 4;
|
||||
|
||||
pd += y + (319-x)*240;
|
||||
ps += x;
|
||||
|
||||
unsigned char *p = (void *)ps;
|
||||
unsigned int *q = (void *)pd;
|
||||
for (u = 0; u < w; u++) {
|
||||
*q = (p[3*328]<<24) + (p[2*328]<<16) + (p[1*328]<<8) + p[0*328];
|
||||
p += 1;
|
||||
q -= 240/4;
|
||||
}
|
||||
}
|
||||
|
||||
void rotated_blit16(void *dst, void *linesx4, int y, int is_32col)
|
||||
{
|
||||
unsigned short *pd = dst, *ps = linesx4;
|
||||
int x, w, u;
|
||||
|
||||
x = (is_32col ? 32 : 0);
|
||||
w = (is_32col ? 256 : 320);
|
||||
y -= 4;
|
||||
|
||||
pd += y + (319-x)*240;
|
||||
ps += x;
|
||||
|
||||
unsigned short *p = (void *)ps;
|
||||
unsigned int *q = (void *)pd;
|
||||
for (u = 0; u < w; u++) {
|
||||
q[0] = (p[1*328]<<16) + p[0*328];
|
||||
q[1] = (p[3*328]<<16) + p[2*328];
|
||||
p += 1;
|
||||
q -= 2*240/4;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,13 +138,13 @@ void screen_blit(u16 *pd, int pp, u8* ps, int ss, u16 *pal)
|
|||
if (currentConfig.scaling == EOPT_SCALE_SW && out_w <= 256) {
|
||||
if (currentConfig.vscaling == EOPT_SCALE_SW && out_h <= 224)
|
||||
// h+v scaling
|
||||
upscale = out_w >= 256 ? upscale_256_224_hv: upscale_160_144_hv;
|
||||
upscale = out_w >= 240 ? upscale_256_224_hv: upscale_160_144_hv;
|
||||
else
|
||||
// h scaling
|
||||
upscale = out_w >= 256 ? upscale_256_____h : upscale_160_____h;
|
||||
upscale = out_w >= 240 ? upscale_256_____h : upscale_160_____h;
|
||||
} else if (currentConfig.vscaling == EOPT_SCALE_SW && out_h <= 224)
|
||||
// v scaling
|
||||
upscale = out_w >= 256 ? upscale_____224_v : upscale_____144_v;
|
||||
upscale = out_w >= 240 ? upscale_____224_v : upscale_____144_v;
|
||||
if (!upscale) {
|
||||
// no scaling
|
||||
for (y = 0; y < out_h; y++)
|
||||
|
@ -165,6 +165,8 @@ void pemu_finalize_frame(const char *fps, const char *notice)
|
|||
|
||||
PicoDrawUpdateHighPal();
|
||||
|
||||
if (out_w == 248 && currentConfig.scaling == EOPT_SCALE_SW)
|
||||
pd += (320 - out_w*320/256) / 2; // SMS with 1st tile blanked, recenter
|
||||
screen_blit(pd, g_screen_ppitch, ps, 328, Pico.est.HighPal);
|
||||
}
|
||||
|
||||
|
@ -205,16 +207,13 @@ void plat_video_set_buffer(void *buf)
|
|||
|
||||
static void apply_renderer(void)
|
||||
{
|
||||
PicoIn.opt &= ~(POPT_ALT_RENDERER|POPT_EN_SOFTSCALE|POPT_DIS_32C_BORDER);
|
||||
PicoIn.opt |= POPT_DIS_32C_BORDER;
|
||||
PicoIn.opt &= ~(POPT_ALT_RENDERER|POPT_EN_SOFTSCALE);
|
||||
if (is_16bit_mode()) {
|
||||
if (currentConfig.scaling == EOPT_SCALE_SW)
|
||||
PicoIn.opt |= POPT_EN_SOFTSCALE;
|
||||
else if (currentConfig.scaling == EOPT_SCALE_HW)
|
||||
// hw scaling, render without any padding
|
||||
PicoIn.opt |= POPT_DIS_32C_BORDER;
|
||||
PicoIn.filter = currentConfig.filter;
|
||||
} else
|
||||
PicoIn.opt |= POPT_DIS_32C_BORDER;
|
||||
}
|
||||
|
||||
switch (get_renderer()) {
|
||||
case RT_16BIT:
|
||||
|
@ -374,8 +373,9 @@ void emu_video_mode_change(int start_line, int line_count, int start_col, int co
|
|||
|
||||
switch (currentConfig.scaling) {
|
||||
case EOPT_SCALE_HW:
|
||||
screen_w = out_w;
|
||||
screen_x = 0;
|
||||
// mind aspect ratio for SMS with 1st column blanked
|
||||
screen_w = (out_w == 248 ? 256 : out_w);
|
||||
screen_x = (screen_w - out_w)/2;
|
||||
break;
|
||||
case EOPT_SCALE_SW:
|
||||
screen_x = (screen_w - 320)/2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue