mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 18:49:18 +01:00
video tweak
This commit is contained in:
parent
c711145d1d
commit
f743ba405a
@ -65,6 +65,7 @@ int main()
|
|||||||
int selectedMenu = -1;
|
int selectedMenu = -1;
|
||||||
|
|
||||||
InitialiseVideo();
|
InitialiseVideo();
|
||||||
|
GX_Start();
|
||||||
|
|
||||||
// Initialise freetype font system
|
// Initialise freetype font system
|
||||||
if (FT_Init ())
|
if (FT_Init ())
|
||||||
|
@ -21,24 +21,23 @@
|
|||||||
|
|
||||||
/*** External 2D Video ***/
|
/*** External 2D Video ***/
|
||||||
/*** 2D Video Globals ***/
|
/*** 2D Video Globals ***/
|
||||||
GXRModeObj *vmode; /*** Graphics Mode Object ***/
|
GXRModeObj *vmode = NULL; // Graphics Mode Object
|
||||||
unsigned int *xfb[2]; /*** Framebuffers ***/
|
unsigned int *xfb[2]; // Framebuffers
|
||||||
int whichfb = 0; /*** Frame buffer toggle ***/
|
int whichfb = 0; // Frame buffer toggle
|
||||||
|
|
||||||
int screenheight;
|
int screenheight;
|
||||||
|
|
||||||
/*** 3D GX ***/
|
/*** 3D GX ***/
|
||||||
#define DEFAULT_FIFO_SIZE ( 256 * 1024 )
|
#define DEFAULT_FIFO_SIZE ( 256 * 1024 )
|
||||||
static u8 gp_fifo[DEFAULT_FIFO_SIZE] ATTRIBUTE_ALIGN(32);
|
static u8 *gp_fifo;
|
||||||
|
|
||||||
/*** Texture memory ***/
|
/*** Texture memory ***/
|
||||||
static u8 *texturemem;
|
static u8 *texturemem = NULL;
|
||||||
static int texturesize;
|
static int texturesize;
|
||||||
|
|
||||||
GXTexObj texobj;
|
GXTexObj texobj;
|
||||||
static Mtx view;
|
static Mtx view;
|
||||||
static int vwidth, vheight, oldvwidth, oldvheight;
|
static int vwidth, vheight, oldvwidth, oldvheight;
|
||||||
unsigned int copynow = GX_FALSE;
|
|
||||||
|
|
||||||
#define HASPECT 80
|
#define HASPECT 80
|
||||||
#define VASPECT 45
|
#define VASPECT 45
|
||||||
@ -72,6 +71,43 @@ static camera cam = { {0.0F, 0.0F, 0.0F},
|
|||||||
{0.0F, 0.0F, -0.5F}
|
{0.0F, 0.0F, -0.5F}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Initialise Video
|
||||||
|
*
|
||||||
|
* Before doing anything in libogc, it's recommended to configure a video
|
||||||
|
* output.
|
||||||
|
****************************************************************************/
|
||||||
|
void InitialiseVideo ()
|
||||||
|
{
|
||||||
|
// Start VIDEO Subsystem
|
||||||
|
VIDEO_Init();
|
||||||
|
|
||||||
|
vmode = VIDEO_GetPreferredMode(NULL);
|
||||||
|
VIDEO_Configure(vmode);
|
||||||
|
|
||||||
|
screenheight = vmode->xfbHeight;
|
||||||
|
|
||||||
|
xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||||
|
xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
||||||
|
|
||||||
|
VIDEO_SetNextFramebuffer(xfb[0]);
|
||||||
|
VIDEO_SetBlack(FALSE);
|
||||||
|
|
||||||
|
// set timings in VI to PAL60
|
||||||
|
/*u32 *vreg = (u32 *)0xCC002000;
|
||||||
|
for (int i = 0; i < 64; i++ )
|
||||||
|
vreg[i] = vpal60[i];*/
|
||||||
|
|
||||||
|
VIDEO_Flush();
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
|
if(vmode->viTVMode & VI_NON_INTERLACE)
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
|
VIDEO_SetPostRetraceCallback((VIRetraceCallback)UpdatePadsCB);
|
||||||
|
VIDEO_SetNextFramebuffer(xfb[0]);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* StartGX
|
* StartGX
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -85,7 +121,7 @@ void GX_Start()
|
|||||||
memset(&gp_fifo, 0, DEFAULT_FIFO_SIZE);
|
memset(&gp_fifo, 0, DEFAULT_FIFO_SIZE);
|
||||||
|
|
||||||
/*** Initialise GX ***/
|
/*** Initialise GX ***/
|
||||||
GX_Init(&gp_fifo, DEFAULT_FIFO_SIZE);
|
GX_Init(gp_fifo, DEFAULT_FIFO_SIZE);
|
||||||
GX_SetCopyClear(gxbackground, 0x00ffffff);
|
GX_SetCopyClear(gxbackground, 0x00ffffff);
|
||||||
|
|
||||||
GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
|
GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
|
||||||
@ -93,8 +129,7 @@ void GX_Start()
|
|||||||
GX_SetScissor(0, 0, vmode->fbWidth, vmode->efbHeight);
|
GX_SetScissor(0, 0, vmode->fbWidth, vmode->efbHeight);
|
||||||
GX_SetDispCopySrc(0, 0, vmode->fbWidth, vmode->efbHeight);
|
GX_SetDispCopySrc(0, 0, vmode->fbWidth, vmode->efbHeight);
|
||||||
GX_SetDispCopyDst(vmode->fbWidth, vmode->xfbHeight);
|
GX_SetDispCopyDst(vmode->fbWidth, vmode->xfbHeight);
|
||||||
GX_SetCopyFilter(vmode->aa, vmode->sample_pattern, GX_TRUE,
|
GX_SetCopyFilter(vmode->aa, vmode->sample_pattern, GX_TRUE, vmode->vfilter);
|
||||||
vmode->vfilter);
|
|
||||||
GX_SetFieldMode(vmode->field_rendering,
|
GX_SetFieldMode(vmode->field_rendering,
|
||||||
((vmode->viHeight ==
|
((vmode->viHeight ==
|
||||||
2 * vmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
|
2 * vmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
|
||||||
@ -121,43 +156,6 @@ UpdatePadsCB ()
|
|||||||
PAD_ScanPads();
|
PAD_ScanPads();
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Initialise Video
|
|
||||||
*
|
|
||||||
* Before doing anything in libogc, it's recommended to configure a video
|
|
||||||
* output.
|
|
||||||
****************************************************************************/
|
|
||||||
void InitialiseVideo ()
|
|
||||||
{
|
|
||||||
/*** Start VIDEO Subsystem ***/
|
|
||||||
VIDEO_Init();
|
|
||||||
|
|
||||||
vmode = VIDEO_GetPreferredMode(NULL);
|
|
||||||
VIDEO_Configure(vmode);
|
|
||||||
|
|
||||||
screenheight = vmode->xfbHeight;
|
|
||||||
|
|
||||||
xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
|
||||||
xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
|
|
||||||
|
|
||||||
VIDEO_SetNextFramebuffer(xfb[0]);
|
|
||||||
VIDEO_SetBlack(FALSE);
|
|
||||||
|
|
||||||
// set timings in VI to PAL60
|
|
||||||
/*u32 *vreg = (u32 *)0xCC002000;
|
|
||||||
for (int i = 0; i < 64; i++ )
|
|
||||||
vreg[i] = vpal60[i];*/
|
|
||||||
|
|
||||||
VIDEO_Flush();
|
|
||||||
VIDEO_WaitVSync();
|
|
||||||
|
|
||||||
if(vmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
|
||||||
VIDEO_SetPostRetraceCallback((VIRetraceCallback)UpdatePadsCB);
|
|
||||||
VIDEO_SetNextFramebuffer(xfb[0]);
|
|
||||||
|
|
||||||
GX_Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Scaler Support Functions
|
* Scaler Support Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -218,8 +216,11 @@ void GX_Render_Init(int width, int height, int haspect, int vaspect)
|
|||||||
|
|
||||||
/*** Allocate 32byte aligned texture memory ***/
|
/*** Allocate 32byte aligned texture memory ***/
|
||||||
texturesize = (width * height) * 2;
|
texturesize = (width * height) * 2;
|
||||||
texturemem = (u8 *) memalign(32, texturesize);
|
|
||||||
|
|
||||||
|
if (texturemem)
|
||||||
|
free(texturemem);
|
||||||
|
|
||||||
|
texturemem = (u8 *) memalign(32, texturesize);
|
||||||
memset(texturemem, 0, texturesize);
|
memset(texturemem, 0, texturesize);
|
||||||
|
|
||||||
/*** Setup for first call to scaler ***/
|
/*** Setup for first call to scaler ***/
|
||||||
@ -307,7 +308,6 @@ void GX_Render(int width, int height, u8 * buffer, int pitch)
|
|||||||
|
|
||||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
//VIDEO_WaitVSync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#define __GXHDR__
|
#define __GXHDR__
|
||||||
|
|
||||||
void InitialiseVideo ();
|
void InitialiseVideo ();
|
||||||
|
void GX_Start();
|
||||||
void GX_Render_Init(int width, int height, int haspect, int vaspect);
|
void GX_Render_Init(int width, int height, int haspect, int vaspect);
|
||||||
void GX_Render(int width, int height, u8 * buffer, int pitch);
|
void GX_Render(int width, int height, u8 * buffer, int pitch);
|
||||||
void clearscreen (int colour = COLOR_BLACK);
|
void clearscreen (int colour = COLOR_BLACK);
|
||||||
|
Loading…
Reference in New Issue
Block a user