sms, basic gamegear support

This commit is contained in:
kub 2021-10-13 21:30:54 +02:00
parent 0df7401c02
commit 466fa07953
16 changed files with 451 additions and 214 deletions

View file

@ -58,9 +58,6 @@
.endif
orr r2, r2, r2, lsr #3
.if \sh == 1
str r2, [r0, #0x40*2*4]
.endif
str r2, [r0], #4
.endm
@ -101,10 +98,10 @@ bgr444_to_rgb32_sh:
subs r12, r12, #1
ldmia r1!, {r4-r7}
convRGB32_2 r4, 1
convRGB32_2 r5, 1
convRGB32_2 r6, 1
convRGB32_2 r7, 1
convRGB32_2 r4, 2
convRGB32_2 r5, 2
convRGB32_2 r6, 2
convRGB32_2 r7, 2
bgt .loopRGB32sh
mov r12, #0x40>>3 @ repeats
@ -112,10 +109,10 @@ bgr444_to_rgb32_sh:
.loopRGB32hi:
ldmia r1!, {r4-r7}
convRGB32_2 r4, 2
convRGB32_2 r5, 2
convRGB32_2 r6, 2
convRGB32_2 r7, 2
convRGB32_2 r4, 1
convRGB32_2 r5, 1
convRGB32_2 r6, 1
convRGB32_2 r7, 1
subs r12, r12, #1
bgt .loopRGB32hi

View file

@ -326,6 +326,8 @@ static void system_announce(void)
if (PicoIn.AHW & PAHW_SMS) {
sys_name = "Master System";
if (Pico.m.hardware & 0x1)
sys_name = "Game Gear";
#ifdef NO_SMS
extra = " [no support]";
#endif
@ -587,7 +589,7 @@ void emu_prep_defconfig(void)
memset(&defaultConfig, 0, sizeof(defaultConfig));
defaultConfig.EmuOpt = EOPT_EN_SRAM | EOPT_EN_SOUND | EOPT_16BPP |
EOPT_EN_CD_LEDS | EOPT_GZIP_SAVES | 0x10/*?*/;
defaultConfig.s_PicoOpt = POPT_EN_SNDFILTER|POPT_EN_YM2413|
defaultConfig.s_PicoOpt = POPT_EN_SNDFILTER|POPT_EN_YM2413|POPT_EN_GG_LCD |
POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80 |
POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_MCD_GFX |
POPT_EN_DRC|POPT_ACC_SPRITES |

View file

@ -42,7 +42,7 @@ static const char *rom_exts[] = {
"bin", "smd", "gen", "md",
"iso", "cso", "cue", "chd",
"32x",
"sms",
"sms", "gg",
NULL
};
@ -536,6 +536,7 @@ static menu_entry e_menu_adv_options[] =
mee_onoff ("Disable YM2612 SSG-EG", MA_OPT2_DISABLE_YM_SSG,PicoIn.opt, POPT_DIS_FM_SSGEG),
mee_onoff ("Emulate SN76496 (PSG)", MA_OPT2_ENABLE_SN76496,PicoIn.opt, POPT_EN_PSG),
mee_onoff ("Emulate YM2413 (FM)", MA_OPT2_ENABLE_YM2413 ,PicoIn.opt, POPT_EN_YM2413),
mee_onoff ("Emulate Game Gear LCD", MA_OPT2_ENABLE_GGLCD ,PicoIn.opt, POPT_EN_GG_LCD),
mee_onoff ("Disable idle loop patching",MA_OPT2_NO_IDLE_LOOPS,PicoIn.opt, POPT_DIS_IDLE_DET),
mee_onoff ("Disable frame limiter", MA_OPT2_NO_FRAME_LIMIT,currentConfig.EmuOpt, EOPT_NO_FRMLIMIT),
mee_onoff ("Enable dynarecs", MA_OPT2_DYNARECS, PicoIn.opt, POPT_EN_DRC),

View file

@ -52,6 +52,7 @@ typedef enum
MA_OPT2_DISABLE_YM_SSG,
MA_OPT2_ENABLE_SN76496,
MA_OPT2_ENABLE_YM2413,
MA_OPT2_ENABLE_GGLCD,
MA_OPT2_NO_LAST_ROM,
MA_OPT2_RAMTIMINGS, /* gp2x */
MA_OPT2_NO_FRAME_LIMIT, /* psp */

View file

@ -35,12 +35,20 @@
*/
#include <pico/pico_types.h>
/* LSB of all colors in a pixel */
#if defined(USE_BGR555)
#define PXLSB 0x0421
#else
#define PXLSB 0x0821
#endif
/* RGB565 pixel mixing, see https://www.compuphase.com/graphic/scale3.htm and
http://blargg.8bitalley.com/info/rgb_mixing.html */
/* 2-level mixing */
//#define p_05(d,p1,p2) d=(((p1)+(p2) + ( ((p1)^(p2))&0x0821))>>1) // round up
//#define p_05(d,p1,p2) d=(((p1)+(p2) - ( ((p1)^(p2))&0x0821))>>1) // round down
#define p_05(d,p1,p2) d=(((p1)&(p2)) + ((((p1)^(p2))&~0x0821)>>1))
//#define p_05(d,p1,p2) d=(((p1)+(p2) + ( ((p1)^(p2))&PXLSB))>>1) // round up
//#define p_05(d,p1,p2) d=(((p1)+(p2) - ( ((p1)^(p2))&PXLSB))>>1) // round down
#define p_05(d,p1,p2) d=(((p1)&(p2)) + ((((p1)^(p2))&~PXLSB)>>1))
/* 4-level mixing, 2 times slower */
// 1/4*p1 + 3/4*p2 = 1/2*(1/2*(p1+p2) + p2)
#define p_025(d,p1,p2) p_05(t, p1, p2); p_05( d, t, p2)
@ -322,6 +330,21 @@ scalers h:
si += ss - w; \
} while (0)
// reverse version for overlapping buffers
#define rh_upscale_nn_1_2(di,ds,si,ss,w,f) do { \
int i; \
di += w*2; \
si += w; \
for (i = w/2; i > 0; i--, si -= 2, di -= 4) { \
di[-1] = f(si[-1]); \
di[-2] = f(si[-1]); \
di[-3] = f(si[-2]); \
di[-4] = f(si[-2]); \
} \
di += ds; \
si += ss; \
} while (0)
#define h_upscale_bl2_1_2(di,ds,si,ss,w,f) do { \
int i; uint p = f(si[0]); \
for (i = w/2; i > 0; i--, si += 2, di += 4) { \
@ -514,11 +537,12 @@ scalers v:
} else { \
int j; \
l = 0; \
di -= 4*ds; \
di -= 3*ds; \
for (j = 0; j < 2; j++) { \
v_copy(&di[0], &di[-ds], w, f_nop); \
di += 2*ds; \
} \
di -= ds; \
} \
} while (0)
@ -528,11 +552,12 @@ scalers v:
} else { \
int j; \
l = 0; \
di -= 4*ds; \
di -= 3*ds; \
for (j = 0; j < 2; j++) { \
v_mix(&di[0], &di[-ds], &di[ds], w, p_05, f_nop); \
di += 2*ds; \
} \
di -= ds; \
} \
} while (0)