- video mode should now always correctly update after changing settings

- widescreen(16:9) support, only enabled on filtered video modes because it degrades quality
This commit is contained in:
michniewski 2008-08-25 05:57:43 +00:00
parent a2048e60ab
commit 9091260171
6 changed files with 51 additions and 19 deletions

View File

@ -33,8 +33,8 @@ CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) \
-DNO_INLINE_GET_SET -DSDD1_DECOMP -DCORRECT_VRAM_READS \
-DDETECT_NASTY_FX_INTERLEAVE -DNGC_ZOOM -DSDUSE_LFN \
-DFORCE_WII -DWII_DVD $(CUSTOMFLAGS) \
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter -pipe
CXXFLAGS = $(CFLAGS)
-fomit-frame-pointer -fno-exceptions -Wno-unused-parameter # -pipe
CXXFLAGS = -save-temps -Xassembler -aln=$@.lst $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map

View File

@ -116,7 +116,7 @@ LoadManager ()
/****************************************************************************
* Preferences Menu
****************************************************************************/
static int prefmenuCount = 15;
static int prefmenuCount = 16;
static char prefmenu[][50] = {
"Load Method",
@ -134,6 +134,7 @@ static char prefmenu[][50] = {
"Display Frame Rate",
"C-Stick Zoom",
"Video Filtering",
"Widescreen",
"Save Preferences",
"Back to Main Menu"
@ -241,6 +242,9 @@ PreferencesMenu ()
sprintf (prefmenu[12], "Render Mode %s",
GCSettings.render == true ? "Filtered" : "Original");
sprintf (prefmenu[13], "Widescreen %s",
GCSettings.widescreen == true ? "ON" : "OFF");
ret = RunMenu (prefmenu, prefmenuCount, (char*)"Preferences", 16);
@ -299,13 +303,18 @@ PreferencesMenu ()
case 12:
GCSettings.render ^= 1;
break;
case 13:
GCSettings.widescreen ^= 1;
if (!GCSettings.render) GCSettings.widescreen = 0; // don't allow on original render modes
break;
case 14:
SavePrefs(GCSettings.SaveMethod, NOTSILENT);
break;
case -1: /*** Button B ***/
case 14:
case 15:
quit = 1;
break;

View File

@ -48,7 +48,10 @@ DefaultSettings ()
GCSettings.NGCZoom = 0;
GCSettings.VerifySaves = 0;
GCSettings.render = 0;
GCSettings.widescreen = 0;
GCSettings.Superscope = 0;
GCSettings.Mouse = 0;
GCSettings.Justifier = 0;

View File

@ -249,7 +249,8 @@ void setFrameTimerMethod()
****************************************************************************/
/* Eke-Eke: initialize frame Sync */
extern void S9xInitSync();
extern int oldvwidth, oldvheight; // for forcing video reset in video.cpp
bool CheckVideo = 0; // for forcing video reset in video.cpp
extern uint32 prevRenderedFrameCount;
void
emulate ()
@ -301,7 +302,8 @@ emulate ()
ConfigRequested = 0;
oldvheight = oldvwidth = 0; // force video update
CheckVideo = 1; // force video update
prevRenderedFrameCount = IPPU.RenderedFramesCount;
}//if ConfigRequested

View File

@ -51,10 +51,11 @@ struct SGCSettings{
char smbshare[20];
int NGCZoom; // 0 - off, 1 - on
int VerifySaves;
int render; // 0 - original, 1 - no AA
int render; // 0 - original, 1 - filtered
int Superscope;
int Mouse;
int Justifier;
int widescreen; // 0 - 4:3 aspect, 1 - 16:9 aspect
};
START_EXTERN_C

View File

@ -301,8 +301,8 @@ copy_to_xfb (u32 arg)
if (copynow == GX_TRUE)
{
GX_SetZMode (GX_TRUE, GX_LEQUAL, GX_TRUE);
GX_SetColorUpdate (GX_TRUE);
//GX_SetZMode (GX_TRUE, GX_LEQUAL, GX_TRUE);
//GX_SetColorUpdate (GX_TRUE);
GX_CopyDisp (xfb[whichfb], GX_TRUE);
GX_Flush ();
copynow = GX_FALSE;
@ -347,7 +347,7 @@ draw_init ()
/* original video mode: force filtering OFF */
if (!GCSettings.render)
GX_InitTexObjLOD(&texobj,GX_NEAR,GX_NEAR_MIP_NEAR,2.5,9.0,0.0,GX_FALSE,GX_FALSE,GX_ANISO_1);
GX_InitTexObjLOD(&texobj,GX_NEAR,GX_NEAR_MIP_NEAR,2.5,9.0,0.0,GX_FALSE,GX_FALSE,GX_ANISO_1);
}
@ -411,7 +411,7 @@ StartGX ()
GX_SetPixelFmt (GX_PF_RGB8_Z24, GX_ZC_LINEAR);
GX_SetCullMode (GX_CULL_NONE);
GX_SetDispCopyGamma (GX_GM_1_0);
GX_SetZMode(GX_FALSE, GX_ALWAYS, GX_TRUE);
GX_SetZMode (GX_TRUE, GX_LEQUAL, GX_TRUE);
GX_SetColorUpdate (GX_TRUE);
// guPerspective (p, 60, 1.33F, 10.0F, 1000.0F);
@ -621,9 +621,10 @@ ResetVideo_Emu ()
GX_LoadProjectionMtx (p, GX_ORTHOGRAPHIC);
// DEBUG
char* msg = "";
sprintf (msg, "Interlaced: %i, vwidth: %d, vheight: %d, fb_W: %u, efb_H: %u", IPPU.Interlace, vwidth, vheight, rmode->fbWidth, rmode->efbHeight);
char* msg = (char*) malloc(256*sizeof(char));
sprintf (msg, (char*)"Interlaced: %i, vwidth: %d, vheight: %d, fb_W: %u, efb_H: %u", IPPU.Interlace, vwidth, vheight, rmode->fbWidth, rmode->efbHeight);
S9xMessage (0, 0, msg);
free(msg);
}
@ -709,10 +710,12 @@ MakeTexture (const void *src, void *dst, s32 width, s32 height)
/****************************************************************************
* Update Video
****************************************************************************/
uint32 prevRenderedFrameCount = 0;
extern bool CheckVideo;
void
update_video (int width, int height)
{
GXRModeObj *rmode;
vwidth = width;
vheight = height;
@ -727,10 +730,11 @@ update_video (int width, int height)
usleep (50);
}
whichfb ^= 1;
if ((oldvheight != vheight) || (oldvwidth != vwidth)) // if rendered width/height changes
if ((oldvheight != vheight) || (oldvwidth != vwidth) // if rendered width/height changes
|| (CheckVideo && (IPPU.RenderedFramesCount != prevRenderedFrameCount)) // or if we get back from the menu, and have rendered at least 1 frame
)
{
int xscale, yscale, xshift, yshift;
yshift = xshift = 0;
@ -748,20 +752,33 @@ update_video (int width, int height)
yscale = (vmode_60hz) ? 240 : 287; // ntsc, pal scaling
}
// aspect ratio scaling (change width scale)
// yes its pretty cheap and ugly, but its easy!
if (GCSettings.widescreen && GCSettings.render) // don't allow this on original render modes because its ugly.
xscale -= (4.0*yscale)/9;
square[6] = square[3] = xscale + xshift;
square[0] = square[9] = -xscale + xshift;
square[4] = square[1] = yscale + yshift;
square[7] = square[10] = -yscale + yshift;
draw_init ();
draw_init ();
GX_InvVtxCache ();
// DEBUG
char* msg = (char*) malloc(256*sizeof(char));
sprintf (msg, (char*)"xscale: %d, yscale: %d", xscale, yscale);
S9xMessage (0, 0, msg);
free(msg);
//GX_SetViewport (0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1);
oldvwidth = vwidth;
oldvheight = vheight;
CheckVideo = 0;
}
GX_InvVtxCache ();
GX_InvalidateTexAll ();
MakeTexture ((char *) GFX.Screen, (char *) texturemem, vwidth, vheight);