code formatting

This commit is contained in:
dborth 2008-11-04 20:43:15 +00:00
parent 72b41f925a
commit e1feb6ea0b

View File

@ -31,9 +31,9 @@ static unsigned char snes9xgfx[1024 * 512 * 2];
extern unsigned int SMBTimer; extern unsigned int SMBTimer;
/*** 2D Video ***/ /*** 2D Video ***/
unsigned int *xfb[2] = { NULL, NULL }; /*** Double buffered ***/ unsigned int *xfb[2] = { NULL, NULL }; // Double buffered
int whichfb = 0; /*** Switch ***/ int whichfb = 0; // Switch
GXRModeObj *vmode; /*** Menu video mode ***/ GXRModeObj *vmode; // Menu video mode
int screenheight; int screenheight;
extern u32* backdrop; extern u32* backdrop;
@ -62,9 +62,9 @@ bool progressive = 0;
/* New texture based scaler */ /* New texture based scaler */
typedef struct tagcamera typedef struct tagcamera
{ {
Vector pos; Vector pos;
Vector up; Vector up;
Vector view; Vector view;
} }
camera; camera;
@ -78,17 +78,17 @@ s16 square[] ATTRIBUTE_ALIGN (32) =
* X, Y, Z * X, Y, Z
* Values set are for roughly 4:3 aspect * Values set are for roughly 4:3 aspect
*/ */
-HASPECT, VASPECT, 0, // 0 -HASPECT, VASPECT, 0, // 0
HASPECT, VASPECT, 0, // 1 HASPECT, VASPECT, 0, // 1
HASPECT, -VASPECT, 0, // 2 HASPECT, -VASPECT, 0, // 2
-HASPECT, -VASPECT, 0 // 3 -HASPECT, -VASPECT, 0 // 3
}; };
static camera cam = { static camera cam = {
{0.0F, 0.0F, 0.0F}, {0.0F, 0.0F, 0.0F},
{0.0F, 0.5F, 0.0F}, {0.0F, 0.5F, 0.0F},
{0.0F, 0.0F, -0.5F} {0.0F, 0.0F, -0.5F}
}; };
@ -113,59 +113,59 @@ GXRModeObj TV_239p =
GX_FALSE, // field_rendering GX_FALSE, // field_rendering
GX_FALSE, // aa GX_FALSE, // aa
// sample points arranged in increasing Y order // sample points arranged in increasing Y order
{ {
{6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each {6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{6,6},{6,6},{6,6}, // pix 1 {6,6},{6,6},{6,6}, // pix 1
{6,6},{6,6},{6,6}, // pix 2 {6,6},{6,6},{6,6}, // pix 2
{6,6},{6,6},{6,6} // pix 3 {6,6},{6,6},{6,6} // pix 3
}, },
// vertical filter[7], 1/64 units, 6 bits each // vertical filter[7], 1/64 units, 6 bits each
{ {
0, // line n-1 0, // line n-1
0, // line n-1 0, // line n-1
21, // line n 21, // line n
22, // line n 22, // line n
21, // line n 21, // line n
0, // line n+1 0, // line n+1
0 // line n+1 0 // line n+1
} }
}; };
/* 478 lines interlaced (PAL 50Hz, Deflicker) */ /* 478 lines interlaced (PAL 50Hz, Deflicker) */
GXRModeObj TV_478i = GXRModeObj TV_478i =
{ {
VI_TVMODE_PAL_INT, // viDisplayMode VI_TVMODE_PAL_INT, // viDisplayMode
512, // fbWidth 512, // fbWidth
478, // efbHeight 478, // efbHeight
478, // xfbHeight 478, // xfbHeight
(VI_MAX_WIDTH_PAL - 640)/2, // viXOrigin (VI_MAX_WIDTH_PAL - 640)/2, // viXOrigin
(VI_MAX_HEIGHT_PAL - 478)/2, // viYOrigin (VI_MAX_HEIGHT_PAL - 478)/2, // viYOrigin
640, // viWidth 640, // viWidth
478, // viHeight 478, // viHeight
VI_XFBMODE_DF, // xFBmode VI_XFBMODE_DF, // xFBmode
GX_FALSE, // field_rendering GX_FALSE, // field_rendering
GX_FALSE, // aa GX_FALSE, // aa
// sample points arranged in increasing Y order // sample points arranged in increasing Y order
{ {
{6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each {6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{6,6},{6,6},{6,6}, // pix 1 {6,6},{6,6},{6,6}, // pix 1
{6,6},{6,6},{6,6}, // pix 2 {6,6},{6,6},{6,6}, // pix 2
{6,6},{6,6},{6,6} // pix 3 {6,6},{6,6},{6,6} // pix 3
}, },
// vertical filter[7], 1/64 units, 6 bits each // vertical filter[7], 1/64 units, 6 bits each
{ {
8, // line n-1 8, // line n-1
8, // line n-1 8, // line n-1
10, // line n 10, // line n
12, // line n 12, // line n
10, // line n 10, // line n
8, // line n+1 8, // line n+1
8 // line n+1 8 // line n+1
} }
}; };
/** Original SNES NTSC Resolutions: **/ /** Original SNES NTSC Resolutions: **/
@ -185,60 +185,60 @@ GXRModeObj TV_224p =
GX_FALSE, // field_rendering GX_FALSE, // field_rendering
GX_FALSE, // aa GX_FALSE, // aa
// sample points arranged in increasing Y order // sample points arranged in increasing Y order
{ {
{6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each {6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{6,6},{6,6},{6,6}, // pix 1 {6,6},{6,6},{6,6}, // pix 1
{6,6},{6,6},{6,6}, // pix 2 {6,6},{6,6},{6,6}, // pix 2
{6,6},{6,6},{6,6} // pix 3 {6,6},{6,6},{6,6} // pix 3
}, },
// vertical filter[7], 1/64 units, 6 bits each // vertical filter[7], 1/64 units, 6 bits each
{ {
0, // line n-1 0, // line n-1
0, // line n-1 0, // line n-1
21, // line n 21, // line n
22, // line n 22, // line n
21, // line n 21, // line n
0, // line n+1 0, // line n+1
0 // line n+1 0 // line n+1
} }
}; };
/* 448 lines interlaced (NTSC or PAL 60Hz, Deflicker) */ /* 448 lines interlaced (NTSC or PAL 60Hz, Deflicker) */
GXRModeObj TV_448i = GXRModeObj TV_448i =
{ {
VI_TVMODE_EURGB60_INT, // viDisplayMode VI_TVMODE_EURGB60_INT, // viDisplayMode
512, // fbWidth 512, // fbWidth
448, // efbHeight 448, // efbHeight
448, // xfbHeight 448, // xfbHeight
(VI_MAX_WIDTH_NTSC - 640)/2, // viXOrigin (VI_MAX_WIDTH_NTSC - 640)/2, // viXOrigin
(VI_MAX_HEIGHT_NTSC - 448)/2, // viYOrigin (VI_MAX_HEIGHT_NTSC - 448)/2, // viYOrigin
640, // viWidth 640, // viWidth
448, // viHeight 448, // viHeight
VI_XFBMODE_DF, // xFBmode VI_XFBMODE_DF, // xFBmode
GX_FALSE, // field_rendering GX_FALSE, // field_rendering
GX_FALSE, // aa GX_FALSE, // aa
// sample points arranged in increasing Y order // sample points arranged in increasing Y order
{ {
{6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each {6,6},{6,6},{6,6}, // pix 0, 3 sample points, 1/12 units, 4 bits each
{6,6},{6,6},{6,6}, // pix 1 {6,6},{6,6},{6,6}, // pix 1
{6,6},{6,6},{6,6}, // pix 2 {6,6},{6,6},{6,6}, // pix 2
{6,6},{6,6},{6,6} // pix 3 {6,6},{6,6},{6,6} // pix 3
}, },
// vertical filter[7], 1/64 units, 6 bits each // vertical filter[7], 1/64 units, 6 bits each
{ {
8, // line n-1 8, // line n-1
8, // line n-1 8, // line n-1
10, // line n 10, // line n
12, // line n 12, // line n
10, // line n 10, // line n
8, // line n+1 8, // line n+1
8 // line n+1 8 // line n+1
} }
}; };
/* TV Modes table */ /* TV Modes table */
@ -305,7 +305,6 @@ InitVideoThread ()
static void static void
copy_to_xfb (u32 arg) copy_to_xfb (u32 arg)
{ {
if (copynow == GX_TRUE) if (copynow == GX_TRUE)
{ {
GX_CopyDisp (xfb[whichfb], GX_TRUE); GX_CopyDisp (xfb[whichfb], GX_TRUE);
@ -346,8 +345,7 @@ draw_init ()
guLookAt(view, &cam.pos, &cam.up, &cam.view); guLookAt(view, &cam.pos, &cam.up, &cam.view);
GX_LoadPosMtxImm (view, GX_PNMTX0); GX_LoadPosMtxImm (view, GX_PNMTX0);
GX_InvVtxCache (); // update vertex cache GX_InvVtxCache (); // update vertex cache
} }
static void static void
@ -472,7 +470,6 @@ InitGCVideo ()
// set VI position // set VI position
TV_224p.viYOrigin = (VI_MAX_HEIGHT_PAL/2 - 448/2)/2; TV_224p.viYOrigin = (VI_MAX_HEIGHT_PAL/2 - 448/2)/2;
TV_448i.viYOrigin = (VI_MAX_HEIGHT_PAL - 448)/2; TV_448i.viYOrigin = (VI_MAX_HEIGHT_PAL - 448)/2;
break; break;
case VI_NTSC: case VI_NTSC:
@ -491,7 +488,6 @@ InitGCVideo ()
TV_224p.viYOrigin = (VI_MAX_HEIGHT_NTSC/2 - 448/2)/2; TV_224p.viYOrigin = (VI_MAX_HEIGHT_NTSC/2 - 448/2)/2;
TV_448i.viYOrigin = (VI_MAX_HEIGHT_NTSC - 448)/2; TV_448i.viYOrigin = (VI_MAX_HEIGHT_NTSC - 448)/2;
break; break;
break;
default: default:
// 480 lines (PAL 60Hz) // 480 lines (PAL 60Hz)
@ -511,13 +507,13 @@ InitGCVideo ()
break; break;
} }
#ifdef HW_DOL #ifdef HW_DOL
/* we have component cables, but the preferred mode is interlaced /* we have component cables, but the preferred mode is interlaced
* why don't we switch into progressive? * why don't we switch into progressive?
* on the Wii, the user can do this themselves on their Wii Settings */ * on the Wii, the user can do this themselves on their Wii Settings */
if(VIDEO_HaveComponentCable()) if(VIDEO_HaveComponentCable())
vmode = &TVNtsc480Prog; vmode = &TVNtsc480Prog;
#endif #endif
// check for progressive scan // check for progressive scan
if (vmode->viTVMode == VI_TVMODE_NTSC_PROG) if (vmode->viTVMode == VI_TVMODE_NTSC_PROG)
@ -576,8 +572,9 @@ ResetVideo_Emu ()
int i = -1; int i = -1;
if (GCSettings.render == 0) // original render mode if (GCSettings.render == 0) // original render mode
{ {
for (i=0; i<4; i++) { for (i=0; i<4; i++)
if (tvmodes[i]->efbHeight == vheight) {
if (tvmodes[i]->efbHeight == vheight)
break; break;
} }
rmode = tvmodes[i]; rmode = tvmodes[i];
@ -590,8 +587,11 @@ ResetVideo_Emu ()
VIDEO_Configure (rmode); VIDEO_Configure (rmode);
VIDEO_Flush(); VIDEO_Flush();
VIDEO_WaitVSync(); VIDEO_WaitVSync();
if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync(); if (rmode->viTVMode & VI_NON_INTERLACE)
else while (VIDEO_GetNextField()) VIDEO_WaitVSync(); VIDEO_WaitVSync();
else
while (VIDEO_GetNextField())
VIDEO_WaitVSync();
GX_SetViewport (0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1); GX_SetViewport (0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1);
@ -630,8 +630,11 @@ ResetVideo_Menu ()
VIDEO_ClearFrameBuffer (vmode, xfb[whichfb], COLOR_BLACK); VIDEO_ClearFrameBuffer (vmode, xfb[whichfb], COLOR_BLACK);
VIDEO_Flush(); VIDEO_Flush();
VIDEO_WaitVSync(); VIDEO_WaitVSync();
if (vmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync(); if (vmode->viTVMode & VI_NON_INTERLACE)
else while (VIDEO_GetNextField()) VIDEO_WaitVSync(); VIDEO_WaitVSync();
else
while (VIDEO_GetNextField())
VIDEO_WaitVSync();
GX_SetViewport (0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1); GX_SetViewport (0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
GX_SetDispCopyYScale ((f32) vmode->xfbHeight / (f32) vmode->efbHeight); GX_SetDispCopyYScale ((f32) vmode->xfbHeight / (f32) vmode->efbHeight);
@ -713,7 +716,7 @@ update_video (int width, int height)
while (copynow == GX_TRUE) while (copynow == GX_TRUE)
#endif #endif
{ {
usleep (50); usleep (50);
} }
whichfb ^= 1; whichfb ^= 1;
@ -732,7 +735,9 @@ update_video (int width, int height)
{ {
xscale = 256; xscale = 256;
yscale = vheight / 2; yscale = vheight / 2;
} else { // unfiltered and filtered mode }
else // unfiltered and filtered mode
{
xscale = 320; xscale = 320;
yscale = vheight; yscale = vheight;
} }