mirror of
https://github.com/dborth/fceugx.git
synced 2024-11-01 06:55:05 +01:00
added comments for modified code
This commit is contained in:
parent
fad26aecb7
commit
6935483ae4
@ -411,10 +411,10 @@ UpdateScaling()
|
||||
{
|
||||
int xscale, yscale;
|
||||
|
||||
/** Update scaling **/
|
||||
// update scaling
|
||||
if (GCSettings.render == 0) // original render mode
|
||||
{
|
||||
xscale = 640 / 2; /* use GX scaler instead VI (less artifacts) */
|
||||
xscale = 640 / 2; // use GX scaler instead VI
|
||||
yscale = 240 / 2;
|
||||
}
|
||||
else // unfiltered and filtered mode
|
||||
@ -504,11 +504,12 @@ InitGCVideo ()
|
||||
if (vmode->viTVMode == VI_TVMODE_NTSC_PROG)
|
||||
progressive = true;
|
||||
|
||||
// configure VI
|
||||
VIDEO_Configure (vmode);
|
||||
|
||||
// always 480 lines
|
||||
screenheight = vmode->xfbHeight;
|
||||
|
||||
|
||||
// Allocate the video buffers
|
||||
xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||
xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||
@ -552,18 +553,19 @@ ResetVideo_Emu ()
|
||||
GXRModeObj *rmode;
|
||||
Mtx p;
|
||||
|
||||
// set VI modes
|
||||
switch (vmode->viTVMode >> 2)
|
||||
{
|
||||
case VI_PAL: /* 576 lines (PAL 50Hz) */
|
||||
case VI_PAL: /* 574 lines (PAL 50Hz) */
|
||||
|
||||
// set video signal mode (50Hz only)
|
||||
// 50Hz only
|
||||
NTSC_240p.viTVMode = VI_TVMODE_PAL_DS;
|
||||
NTSC_240p.viYOrigin = (VI_MAX_HEIGHT_PAL - 480)/2;
|
||||
break;
|
||||
|
||||
case VI_NTSC: /* 480 lines (NTSC 60hz) */
|
||||
|
||||
// set video signal mode (60Hz only)
|
||||
// 60Hz only
|
||||
PAL_240p.viTVMode = VI_TVMODE_NTSC_DS;
|
||||
PAL_240p.viYOrigin = (VI_MAX_HEIGHT_NTSC - 480)/2;
|
||||
NTSC_240p.viTVMode = VI_TVMODE_NTSC_DS;
|
||||
@ -571,13 +573,14 @@ ResetVideo_Emu ()
|
||||
|
||||
default: /* 480 lines (PAL 60Hz) */
|
||||
|
||||
// set video signal mode (supports both 50/60Hz but we use 60hz for both PAL & NTSC settings)
|
||||
// supports both 50/60Hz but better use 60hz by default
|
||||
PAL_240p.viTVMode = VI_TVMODE(vmode->viTVMode >> 2, VI_NON_INTERLACE);
|
||||
PAL_240p.viYOrigin = (VI_MAX_HEIGHT_NTSC - 480)/2;
|
||||
NTSC_240p.viTVMode = VI_TVMODE(vmode->viTVMode >> 2, VI_NON_INTERLACE);
|
||||
break;
|
||||
}
|
||||
|
||||
// choose current VI mode
|
||||
if (GCSettings.render == 0) // original render mode
|
||||
{
|
||||
rmode = tvmodes[GCSettings.timing];
|
||||
@ -591,7 +594,7 @@ ResetVideo_Emu ()
|
||||
rmode = vmode; // same mode as menu
|
||||
}
|
||||
|
||||
|
||||
// reconfigure VI
|
||||
VIDEO_Configure (rmode);
|
||||
VIDEO_ClearFrameBuffer (rmode, xfb[whichfb], COLOR_BLACK);
|
||||
VIDEO_Flush();
|
||||
@ -599,18 +602,15 @@ ResetVideo_Emu ()
|
||||
if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
else while (VIDEO_GetNextField()) VIDEO_WaitVSync();
|
||||
|
||||
|
||||
// reconfigure GX
|
||||
GX_SetViewport (0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1);
|
||||
GX_SetDispCopyYScale ((f32) rmode->xfbHeight / (f32) rmode->efbHeight);
|
||||
GX_SetScissor (0, 0, rmode->fbWidth, rmode->efbHeight);
|
||||
|
||||
GX_SetDispCopySrc (0, 0, rmode->fbWidth, rmode->efbHeight);
|
||||
GX_SetDispCopyDst (rmode->fbWidth, rmode->xfbHeight);
|
||||
GX_SetCopyFilter (rmode->aa, rmode->sample_pattern, (GCSettings.render == 1) ? GX_TRUE : GX_FALSE, rmode->vfilter); // Deflickering Filter only for filtered mode
|
||||
|
||||
GX_SetCopyFilter (rmode->aa, rmode->sample_pattern, (GCSettings.render == 1) ? GX_TRUE : GX_FALSE, rmode->vfilter); // deflickering filter only for filtered mode
|
||||
GX_SetFieldMode (rmode->field_rendering, ((rmode->viHeight == 2 * rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
|
||||
GX_SetPixelFmt (GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
||||
|
||||
guOrtho(p, rmode->efbHeight/2, -(rmode->efbHeight/2), -(rmode->fbWidth/2), rmode->fbWidth/2, 10, 1000); // matrix, t, b, l, r, n, f
|
||||
GX_LoadProjectionMtx (p, GX_ORTHOGRAPHIC);
|
||||
|
||||
@ -620,6 +620,7 @@ ResetVideo_Emu ()
|
||||
if (!(GCSettings.render&1))
|
||||
GX_InitTexObjLOD(&texobj,GX_NEAR,GX_NEAR_MIP_NEAR,2.5,9.0,0.0,GX_FALSE,GX_FALSE,GX_ANISO_1); // original/unfiltered video mode: force texture filtering OFF
|
||||
|
||||
// set aspect ratio
|
||||
UpdateScaling();
|
||||
}
|
||||
|
||||
@ -667,8 +668,10 @@ void RenderFrame(unsigned char *XBuf)
|
||||
while ((LWP_ThreadIsSuspended (vbthread) == 0) || (copynow == GX_TRUE))
|
||||
usleep (50);
|
||||
|
||||
// swap framebuffers
|
||||
whichfb ^= 1;
|
||||
|
||||
// zoom has changed
|
||||
if(updateScaling)
|
||||
{
|
||||
UpdateScaling();
|
||||
@ -682,10 +685,10 @@ void RenderFrame(unsigned char *XBuf)
|
||||
u8 *src3 = XBuf + 512;
|
||||
u8 *src4 = XBuf + 768;
|
||||
|
||||
/* clear texture objects in memory */
|
||||
// clear texture objects
|
||||
GX_InvalidateTexAll();
|
||||
|
||||
// Now draw the texture
|
||||
// fill the texture
|
||||
for (height = 0; height < 240; height += 4)
|
||||
{
|
||||
for (width = 0; width < 256; width += 4)
|
||||
@ -720,15 +723,15 @@ void RenderFrame(unsigned char *XBuf)
|
||||
src4 += 768; // line 4*(N+3)
|
||||
}
|
||||
|
||||
/* load texture into GX */
|
||||
// load texture into GX
|
||||
DCFlushRange(texturemem, TEX_WIDTH * TEX_HEIGHT * 2);
|
||||
GX_LoadTexObj (&texobj, GX_TEXMAP0);
|
||||
|
||||
/* render textured quad */
|
||||
// render textured quad
|
||||
draw_square(view);
|
||||
GX_DrawDone();
|
||||
|
||||
/* EFB is ready to be copied into XFB */
|
||||
// EFB is ready to be coied into XFB
|
||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
||||
VIDEO_Flush();
|
||||
copynow = GX_TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user