This commit is contained in:
twinaphex 2016-05-20 12:13:01 +02:00
commit 9e7ee25c15
8 changed files with 30 additions and 44 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -2,7 +2,7 @@
* Genesis Plus * Genesis Plus
* CD drive processor & CD-DA fader * CD drive processor & CD-DA fader
* *
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX) * Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met:
@ -1570,9 +1570,9 @@ void cdd_process(void)
{ {
/* Fixes a few games hanging during intro because they expect data to be read with some delay */ /* Fixes a few games hanging during intro because they expect data to be read with some delay */
/* Radical Rex needs at least one interrupt delay */ /* Radical Rex needs at least one interrupt delay */
/* Wolf Team games (Anet Futatabi, Cobra Command, Road Avenger & Time Gal) need at least 7 interrupts delay */ /* Wolf Team games (Anet Futatabi, Cobra Command, Earnest Evans, Road Avenger & Time Gal) need at least 10 interrupts delay */
/* Space Adventure Cobra (2nd morgue scene) needs at least 13 interrupts delay (incl. seek time, so 7 is OK) */ /* Space Adventure Cobra (2nd morgue scene) needs at least 13 interrupts delay (incl. seek time, so 10 is OK) */
cdd.latency = 7; cdd.latency = 10;
} }
/* CD drive seek time */ /* CD drive seek time */

View File

@ -2,7 +2,7 @@
* Genesis Plus * Genesis Plus
* CD drive processor & CD-DA fader * CD drive processor & CD-DA fader
* *
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX) * Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met:

View File

@ -1366,7 +1366,7 @@ void system_frame_sms(int do_skip)
/* Master System & Game Gear VDP specific */ /* Master System & Game Gear VDP specific */
else else
{ {
/* Sprites are still processed during vertical borders */ /* Sprites are still processed during top border */
if (reg[1] & 0x40) if (reg[1] & 0x40)
{ {
render_obj(1); render_obj(1);

View File

@ -3731,8 +3731,8 @@ void parse_satb_m4(int line)
break; break;
} }
/* Wrap Y coordinate for sprites > 256-16 */ /* Wrap Y coordinate (NB: this is likely not 100% accurate and needs to be verified on real hardware) */
if (ypos > 240) if (ypos > (bitmap.viewport.h + 16))
{ {
ypos -= 256; ypos -= 256;
} }

View File

@ -80,8 +80,8 @@ static gx_texture *cd_leds[2][2];
static GXTexObj screenTexObj; static GXTexObj screenTexObj;
/*** Framebuffers ***/ /*** Framebuffers ***/
static u32 *xfb; static u32 *xfb[2];
static u32 drawDone; static u8 fbCurrent;
/*** Frame Sync ***/ /*** Frame Sync ***/
u32 videoSync; u32 videoSync;
@ -391,26 +391,17 @@ static void vi_callback(u32 cnt)
videoWait = 0; videoWait = 0;
} }
/* XFB update */
static void xfb_update(u32 cnt)
{
/* check if EFB rendering is finished */
if (drawDone)
{
/* clear GX draw end flag */
drawDone = 0;
/* copy EFB to XFB */
GX_CopyDisp(xfb, GX_FALSE);
GX_Flush();
}
}
/* GX draw callback */ /* GX draw callback */
static void gx_callback(void) static void gx_callback(void)
{ {
/* set GX draw end flag */ /* swap framebuffers */
drawDone = 1; fbCurrent ^= 1;
VIDEO_SetNextFramebuffer(xfb[fbCurrent]);
VIDEO_Flush();
/* copy EFB to XFB */
GX_CopyDisp(xfb[fbCurrent], GX_FALSE);
GX_Flush();
} }
/* Initialize GX */ /* Initialize GX */
@ -1076,7 +1067,7 @@ void gxSaveScreenshot(char *filename)
void gxSetScreen(void) void gxSetScreen(void)
{ {
VIDEO_WaitVSync(); VIDEO_WaitVSync();
GX_CopyDisp(xfb, GX_FALSE); GX_CopyDisp(xfb[fbCurrent], GX_FALSE);
GX_Flush(); GX_Flush();
gx_input_UpdateMenu(); gx_input_UpdateMenu();
} }
@ -1239,7 +1230,7 @@ gx_texture *gxTextureOpenPNG(const u8 *png_data, FILE *png_file)
/* initialize GX texture object */ /* initialize GX texture object */
GX_InitTexObj(&texture->texObj, texture->data, width, height, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE); GX_InitTexObj(&texture->texObj, texture->data, width, height, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
/*GX_InitTexObjLOD(&texture->texObj,GX_LINEAR,GX_LIN_MIP_LIN,0.0,10.0,0.0,GX_FALSE,GX_TRUE,GX_ANISO_4);*/
/* encode to GX_TF_RGBA8 format (4x4 pixels paired titles) */ /* encode to GX_TF_RGBA8 format (4x4 pixels paired titles) */
u16 *dst_ar = (u16 *)(texture->data); u16 *dst_ar = (u16 *)(texture->data);
u16 *dst_gb = (u16 *)(texture->data + 32); u16 *dst_gb = (u16 *)(texture->data + 32);
@ -1449,7 +1440,6 @@ void gx_video_Stop(void)
{ {
/* disable VSYNC callbacks */ /* disable VSYNC callbacks */
VIDEO_SetPostRetraceCallback(NULL); VIDEO_SetPostRetraceCallback(NULL);
VIDEO_SetPreRetraceCallback(NULL);
/* wait for next even field */ /* wait for next even field */
/* this prevents screen artefacts when switching between interlaced & non-interlaced modes */ /* this prevents screen artefacts when switching between interlaced & non-interlaced modes */
@ -1670,9 +1660,6 @@ void gx_video_Start(void)
VIDEO_SetGamma((int)(config.gamma * 10.0)); VIDEO_SetGamma((int)(config.gamma * 10.0));
#endif #endif
/* XFB update is done during VBLANK */
VIDEO_SetPreRetraceCallback(xfb_update);
/* Emulation is synchronized with video hardware if VSYNC is set to AUTO & TV mode matches emulated video mode */ /* Emulation is synchronized with video hardware if VSYNC is set to AUTO & TV mode matches emulated video mode */
if (config.vsync && (gc_pal == vdp_pal)) if (config.vsync && (gc_pal == vdp_pal))
{ {
@ -1760,16 +1747,13 @@ int gx_video_Update(int status)
DCStoreRange(bitmap.data, vwidth*vheight*2); DCStoreRange(bitmap.data, vwidth*vheight*2);
GX_InvalidateTexAll(); GX_InvalidateTexAll();
/* disable EFB copy until rendering is done */
drawDone = 0;
/* render textured quad */ /* render textured quad */
GX_CallDispList(screenDisplayList, 32); GX_CallDispList(screenDisplayList, 32);
/* on-screen display */ /* on-screen display */
if (osd) if (osd)
{ {
/* reset GX rendering */ /* reset GX rendering mode */
gxResetRendering(1); gxResetRendering(1);
/* lightgun # 1 screen mark */ /* lightgun # 1 screen mark */
@ -1829,7 +1813,7 @@ int gx_video_Update(int status)
/* restore texture object */ /* restore texture object */
GX_LoadTexObj(&screenTexObj, GX_TEXMAP0); GX_LoadTexObj(&screenTexObj, GX_TEXMAP0);
/* restore GX rendering */ /* restore GX rendering mode */
gxResetRendering(0); gxResetRendering(0);
} }
@ -1904,17 +1888,19 @@ void gx_video_Init(void)
/* Configure VI */ /* Configure VI */
VIDEO_Configure(vmode); VIDEO_Configure(vmode);
/* Allocate framebuffer */ /* Allocate framebuffers */
xfb = (u32 *) MEM_K0_TO_K1((u32 *) SYS_AllocateFramebuffer(&TV50hz_576i)); xfb[0] = (u32 *) MEM_K0_TO_K1((u32 *) SYS_AllocateFramebuffer(&TV50hz_576i));
xfb[1] = (u32 *) MEM_K0_TO_K1((u32 *) SYS_AllocateFramebuffer(&TV50hz_576i));
/* Define a console */ /* Define a console */
console_init(xfb, 20, 64, 640, 574, 574 * 2); console_init(xfb[0], 20, 64, 640, 574, 574 * 2);
/* Clear framebuffer to black */ /* Clear framebuffer to black */
VIDEO_ClearFrameBuffer(vmode, xfb, COLOR_BLACK); VIDEO_ClearFrameBuffer(vmode, xfb[0], COLOR_BLACK);
/* Set the framebuffer to be displayed at next VBlank */ /* Set the framebuffer to be displayed at next VBlank */
VIDEO_SetNextFramebuffer(xfb); VIDEO_SetNextFramebuffer(xfb[0]);
fbCurrent = 0;
/* Enable Video Interface */ /* Enable Video Interface */
VIDEO_SetBlack(FALSE); VIDEO_SetBlack(FALSE);
@ -1938,7 +1924,7 @@ void gx_video_Init(void)
void gx_video_Shutdown(void) void gx_video_Shutdown(void)
{ {
FONT_Shutdown(); FONT_Shutdown();
VIDEO_ClearFrameBuffer(vmode, xfb, COLOR_BLACK); VIDEO_ClearFrameBuffer(vmode, xfb[fbCurrent], COLOR_BLACK);
VIDEO_Flush(); VIDEO_Flush();
VIDEO_WaitVSync(); VIDEO_WaitVSync();
} }