diff --git a/history.txt b/history.txt index 5fa4a62..2f5e0bc 100644 --- a/history.txt +++ b/history.txt @@ -16,10 +16,12 @@ CURRENT: [NGC/Wii] -- removed unused libsamplerate settings for HQ YM2612 (now use "FAST" setting for MAME by default) -- improved fast scrolling in menus when using Wiimote D-PAD -- fixed config file incompatibility between GC and Wii versions +- now use fixed libsamplerate setting in "HQ YM2612" mode +- implemented menu fast scrolling with the Wiimote D-PAD +- fixed config file incompatibilities between Gamecube and Wii versions - re-enabled texture filtering in H40 original mode when overscan is emulated: fix screen scroll tearing +- added Shay Green's NTSC Filters support +- added proper 480p menu detection for NTSC Gamecube users 26/08/2008: diff --git a/source/ngc/gui/menu.c b/source/ngc/gui/menu.c index 7de884d..570e15e 100644 --- a/source/ngc/gui/menu.c +++ b/source/ngc/gui/menu.c @@ -319,13 +319,15 @@ void dispmenu () while (quit == 0) { - sprintf (items[0], "Aspect: %s", config.aspect ? "ORIGINAL" : "STRETCH"); - if (config.render == 1) sprintf (items[1], "TV Mode: INTERLACED"); - else if (config.render == 2) sprintf (items[1], "TV Mode: PROGRESSIVE"); - else sprintf (items[1], "TV Mode: ORIGINAL"); - if (config.tv_mode == 0) sprintf (items[2], "TV Frequency: 60HZ"); - else if (config.tv_mode == 1) sprintf (items[2], "TV Frequency: 50HZ"); - else sprintf (items[2], "TV Frequency: 50/60HZ"); + ogc_video__scale(); + + sprintf (items[0], "Aspect: %s", config.aspect ? "ORIGINAL" : "STRETCH"); + if (config.render == 1) sprintf (items[1], "Render: INTERLACED"); + else if (config.render == 2) sprintf (items[1], "Render: PROGRESSIVE"); + else sprintf (items[1], "Render: ORIGINAL"); + if (config.tv_mode == 0) sprintf (items[2], "TV Mode: 60HZ"); + else if (config.tv_mode == 1) sprintf (items[2], "TV Mode: 50HZ"); + else sprintf (items[2], "TV Mode: 50/60HZ"); sprintf (items[3], "Texture Filter: %s", config.filtering ? " ON" : "OFF"); if (config.ntsc == 1) sprintf (items[4], "NTSC Filter: COMPOSITE"); else if (config.ntsc == 2) sprintf (items[4], "NTSC Filter: S-VIDEO"); @@ -334,8 +336,8 @@ void dispmenu () sprintf (items[5], "Borders: %s", config.overscan ? " ON" : "OFF"); sprintf (items[6], "Center X: %s%02d", config.xshift < 0 ? "-":"+", abs(config.xshift)); sprintf (items[7], "Center Y: %s%02d", config.yshift < 0 ? "-":"+", abs(config.yshift)); - sprintf (items[8], "Scale X: %s%02d", config.xscale < 0 ? "-":"+", abs(config.xscale)); - sprintf (items[9], "Scale Y: %s%02d", config.yscale < 0 ? "-":"+", abs(config.yscale)); + sprintf (items[8], "Scale X: %02d", xscale*2); + sprintf (items[9], "Scale Y: %02d", yscale*2); ret = domenu (&items[0], count, 1); @@ -373,13 +375,16 @@ void dispmenu () case 3: /*** texture filtering ***/ config.filtering ^= 1; + bitmap.viewport.changed = 1; break; case 4: /*** NTSC filter ***/ config.ntsc ++; if (config.ntsc > 3) config.ntsc = 0; + bitmap.viewport.changed = 1; break; - case 5: /*** overscan emulation ***/ + + case 5: /*** overscan emulation ***/ config.overscan ^= 1; bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0; bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0; diff --git a/source/ngc/ogc_video.c b/source/ngc/ogc_video.c index a3ff712..6af5580 100644 --- a/source/ngc/ogc_video.c +++ b/source/ngc/ogc_video.c @@ -33,7 +33,7 @@ sms_ntsc_t sms_ntsc; /*** PAL 50hz flag ***/ -uint8 gc_pal = 0; +int gc_pal = 0; /*** VI ***/ unsigned int *xfb[2]; /*** Double buffered ***/ @@ -307,7 +307,7 @@ static void draw_init(void) /* Clear all Vertex params */ GX_ClearVtxDesc (); - /* Set Position Params (set quad aspect ratio) */ + /* Set Position Params (quad aspect ratio) */ GX_SetVtxAttrFmt (GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); GX_SetVtxDesc (GX_VA_POS, GX_INDEX8); GX_SetArray (GX_VA_POS, square, 3 * sizeof (s16)); @@ -320,10 +320,12 @@ static void draw_init(void) GX_SetNumTexGens (1); GX_SetNumChans(0); - /** Set Modelview **/ + /* Set Modelview */ memset (&view, 0, sizeof (Mtx)); guLookAt(view, &cam.pos, &cam.up, &cam.view); GX_LoadPosMtxImm (view, GX_PNMTX0); + + GX_InvVtxCache (); } /* vertex rendering */ @@ -387,9 +389,10 @@ static void gxStart(void) } /* set GX scaler */ -static void gxScale(void) +int xscale, yscale; +void ogc_video__scale(void) { - int xscale, yscale, xshift, yshift, i; + int scale, xshift, yshift, i; /* borders are emulated */ if (config.overscan) @@ -439,18 +442,18 @@ static void gxScale(void) xshift += config.xshift; yshift += config.yshift; - - /* check horizontal upscaling */ - if (xscale > 320) + + /* horizontal scaling */ + scale = (xscale > 360) ? 360 : xscale; + if (scale > 320) { /* let VI do horizontal scaling */ - uint32 scale = (xscale <= 360) ? xscale : 360; for (i=0; i<6; i++) { tvmodes[i]->viXOrigin = (720 - (scale * 2)) / 2; tvmodes[i]->viWidth = scale * 2; } - xscale -= (scale - 320); + scale = 320; } else { @@ -462,23 +465,16 @@ static void gxScale(void) } } - /* double resolution */ - if (config.render) - { - yscale *= 2; - yshift *= 2; - } + square[6] = square[3] = scale + xshift; + square[0] = square[9] = -scale + xshift; - /* update matrix */ - square[6] = square[3] = xscale + xshift; - square[0] = square[9] = -xscale + xshift; - square[4] = square[1] = yscale + yshift; - square[7] = square[10] = -yscale + yshift; + /* vertical scaling */ + scale = yscale; + square[4] = square[1] = (scale + yshift) * (config.render ? 2:1); + square[7] = square[10] = (yshift - scale) * (config.render ? 2:1); + + /* update position matrix */ draw_init(); - - /* vertex array have been modified */ - GX_InvVtxCache (); - } /* Reinitialize GX */ @@ -487,14 +483,14 @@ void ogc_video__reset() GXRModeObj *rmode; Mtx p; - /* reinitialize GC/Wii PAL mode */ + /* reset TV type (50Hz/60Hz) */ if ((config.tv_mode == 1) || ((config.tv_mode == 2) && vdp_pal)) gc_pal = 1; else gc_pal = 0; - /* reset scaler */ - gxScale(); + /* reset scaler (aspect ratio) */ + ogc_video__scale(); - /* reinitialize current TV mode */ + /* reset TV mode */ if (config.render == 2) { tvmodes[2]->viTVMode = VI_TVMODE_NTSC_PROG; @@ -505,11 +501,9 @@ void ogc_video__reset() tvmodes[2]->viTVMode = tvmodes[0]->viTVMode & ~3; tvmodes[2]->xfbMode = VI_XFBMODE_DF; } - - if (config.render) rmode = tvmodes[gc_pal*3 + 2]; + if (config.render) rmode = tvmodes[gc_pal*3 + 2]; else rmode = tvmodes[gc_pal*3 + interlaced]; - VIDEO_Configure (rmode); VIDEO_ClearFrameBuffer(rmode, xfb[whichfb], COLOR_BLACK); VIDEO_Flush(); @@ -531,7 +525,7 @@ void ogc_video__reset() guOrtho(p, rmode->efbHeight/2, -(rmode->efbHeight/2), -(rmode->fbWidth/2), rmode->fbWidth/2, 100, 1000); GX_LoadProjectionMtx (p, GX_ORTHOGRAPHIC); - /* init NTSC filter */ + /* reset NTSC filter */ if (config.ntsc == 1) { sms_setup = sms_ntsc_composite; @@ -546,7 +540,7 @@ void ogc_video__reset() sms_ntsc_init( &sms_ntsc, &sms_setup ); md_ntsc_init( &md_ntsc, &md_setup ); } - if (config.ntsc == 1) + else if (config.ntsc == 3) { sms_setup = sms_ntsc_rgb; md_setup = md_ntsc_rgb; @@ -592,11 +586,15 @@ void ogc_video__update() if (config.render && (interlaced || config.ntsc)) vheight *= 2; if (config.ntsc) vwidth = (reg[12]&1) ? MD_NTSC_OUT_WIDTH(vwidth) : SMS_NTSC_OUT_WIDTH(vwidth); + /* texels size must be multiple of 4 */ + vwidth = (vwidth / 4) * 4; + vheight = (vheight / 4) * 4; + /* final offset */ stride = bitmap.width - (vwidth >> 2); /* reset GX scaler */ - gxScale(); + ogc_video__scale(); /* reinitialize texture */ GX_InvalidateTexAll (); @@ -670,7 +668,7 @@ void ogc_video__init(void) } /* Get the current video mode then : - - set menu video mode (fullscreen, 480i or 576i) + - set menu video mode (480p, 480i or 576i) - set emulator rendering TV modes (PAL/MPAL/NTSC/EURGB60) */ vmode = VIDEO_GetPreferredMode(NULL); diff --git a/source/ngc/ogc_video.h b/source/ngc/ogc_video.h index eac3e04..48af6f2 100644 --- a/source/ngc/ogc_video.h +++ b/source/ngc/ogc_video.h @@ -24,10 +24,11 @@ extern void ogc_video__init(void); extern void ogc_video__update(void); extern void ogc_video__reset(void); +extern void ogc_video__scale(void); -extern u8 gc_pal; +extern int gc_pal; extern unsigned int *xfb[2]; -extern int whichfb; +extern int whichfb, xscale, yscale; extern GXRModeObj *tvmodes[6]; extern GXRModeObj *vmode; diff --git a/source/render.c b/source/render.c index 05bcb58..4e37171 100644 --- a/source/render.c +++ b/source/render.c @@ -22,7 +22,6 @@ ****************************************************************************************/ #include "shared.h" - #include "md_ntsc.h" #include "sms_ntsc.h"