📄 blit.c
字号:
#include "osd.h"
/* Index of blitter proc from table */
int blitter_index;
/* Points to currently used blitter proc */
void (*blitter_proc)(BITMAP *src, BITMAP *dst) = NULL;
/* Pick an appropriate blitter proc based on settings */
void pick_blitter_proc(void)
{
/* Color depth */
int f_d = (option.video_depth == 16) ? 1 : 0;
/* 1= Don't use VGA vertical scaling (write odd lines manually) */
int f_v = (option.no_vga) ? 1 : 0;
/* 1= Use MMX */
int f_m = (option.no_mmx) ? 0 : 1;
/* 1= Do screen expansion */
int f_e = (option.expand) ? 1 : 0;
/* 1= Do screen scaling */
int f_z = (option.scale) ? 1 : 0;
/* 1= Use scanlines effect */
int f_s = (option.scanlines) ? 1 : 0;
/* 1= GG, 0= SMS */
int f_g = (cart.type == TYPE_GG) ? 1 : 0;
/* Disable zooming if expansion is on */
if(f_e && f_z) f_z = 0;
/* Ignore VGA and MMX disable switches if not using expansion */
if(!f_e) { f_v = f_m = 0; };
/* If expansion and scanlines are on, ignore VGA disable */
if(f_e && f_s) f_v = 0;
/* Form index */
blitter_index = (f_d << 6 | f_v << 5 | f_m << 4 | f_e << 3 | f_z << 2 | f_s << 1 | f_g) & 0x7F;
/* Assign blitter proc */
blitter_proc = blit_table[blitter_index];
/* Assign custom blitters */
if(option.tweak) blitter_proc = IS_GG ? blit_gg_twk : blit_sms_twk;
}
/* "C" blitter functions */
void blit_sms(BITMAP *src, BITMAP *dst) {
blit(src, dst, 0, 0, (SCREEN_W-256)/2, (SCREEN_H-192)/2, 256, 192);
}
void blit_sms_scanlines(BITMAP *src, BITMAP *dst) {
int i;
for(i=0;i<192;i+=1)
blit(src, dst, 0, i, (SCREEN_W-256)/2, (((SCREEN_H/2)-192))+(i << 1), 256, 1);
}
void blit_gg(BITMAP *src, BITMAP *dst) {
blit(src, dst, 48, 24, (SCREEN_W-160)/2, (SCREEN_H-144)/2, 160, 144);
}
void blit_gg_scanlines(BITMAP *src, BITMAP *dst) {
int i;
for(i=0;i<144;i+=1)
blit(src, dst, 48, 24+i, (SCREEN_W-160)/2, (((SCREEN_H/2)-144))+(i << 1), 160, 1);
}
void blit_sms_scale(BITMAP *src, BITMAP *dst) {
stretch_blit(src, dst, 0, 0, 256, 192, 0, 0, SCREEN_W, SCREEN_H);
}
void blit_sms_scale_scanlines(BITMAP *src, BITMAP *dst) {
int i;
for(i=0;i<192;i+=1)
stretch_blit(src, dst, 0, i, 256, 1, 0, (((SCREEN_H/2)-192))+(i << 1), SCREEN_W, 1);
}
void blit_gg_scale(BITMAP *src, BITMAP *dst) {
stretch_blit(src, dst, 48, 24, 160, 144, 0, 0, SCREEN_W, SCREEN_H);
}
void blit_gg_scale_scanlines(BITMAP *src, BITMAP *dst) {
int i;
for(i=0;i<144;i+=1)
stretch_blit(src, dst, 48, 24+i, 160, 1, 0, (((SCREEN_H/2)-144))+(i << 1), SCREEN_W, 1);
}
void blit_sms_twk(BITMAP *src, BITMAP *dst) {
blit(src, dst, 0, 0, 0, 0, 256, 192);
}
void blit_gg_twk(BITMAP *src, BITMAP *dst) {
blit(src, dst, 48, 24, 0, 0, 160, 144);
}
/* List of blitter functions */
void (*blit_table[])(BITMAP *src, BITMAP *dst) =
{
blit_sms ,
blit_gg ,
blit_sms_scanlines ,
blit_gg_scanlines ,
blit_sms_scale ,
blit_gg_scale ,
blit_sms_scale_scanlines ,
blit_gg_scale_scanlines ,
blit_sms_expand ,
blit_gg_expand ,
blit_sms_expand_scanlines ,
blit_gg_expand_scanlines ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
blit_sms_expand_mmx ,
blit_gg_expand_mmx ,
blit_sms_expand_scanlines_mmx ,
blit_gg_expand_scanlines_mmx ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
blit_sms_expand_vs ,
blit_gg_expand_vs ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
blit_sms_expand_mmx_vs ,
blit_gg_expand_mmx_vs ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
blit_sms ,
blit_gg ,
blit_sms_scanlines ,
blit_gg_scanlines ,
blit_sms_scale ,
blit_gg_scale ,
blit_sms_scale_scanlines ,
blit_gg_scale_scanlines ,
blit_sms_expand_16 ,
blit_gg_expand_16 ,
blit_sms_expand_scanlines_16 ,
blit_gg_expand_scanlines_16 ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
blit_sms_expand_mmx_16 ,
blit_gg_expand_mmx_16 ,
blit_sms_expand_scanlines_mmx_16 ,
blit_gg_expand_scanlines_mmx_16 ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
blit_sms_expand_vs_16 ,
blit_gg_expand_vs_16 ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
blit_sms_expand_mmx_vs_16 ,
blit_gg_expand_mmx_vs_16 ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
NULL ,
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -