Code: Select all
void initGraphics()
{
int SCREEN_WIDTH, SCREEN_HEIGHT;
// puts display mask into the status specified by the mask (0 not displayed, 1 displayed)
SetDispMask(1);
// resets the graphic system (0 full reset, 1 cancels the current drawing and flushes the command buffer, 3 initialises the drawing engine while preserving the current display environment)
ResetGraph(0);
// clear all VRAM contents
//clearVRAM();
// automatic video mode control
if (*(char *)0xbfc7ff52=='E') // SCEE string address
{
// PAL MODE
SCREEN_WIDTH = 320;
SCREEN_HEIGHT = 256;
if (DEBUG) printf("Setting the PlayStation Video Mode to (PAL %dx%d)\n",SCREEN_WIDTH,SCREEN_HEIGHT,")");
SetVideoMode(1);
if (DEBUG_DISPLAY) printf("Video Mode is (%d)\n",GetVideoMode());
}
else
{
// NTSC MODE
SCREEN_WIDTH = 320;
SCREEN_HEIGHT = 240;
if (DEBUG) printf("Setting the PlayStation Video Mode to (NTSC %dx%d)\n",SCREEN_WIDTH,SCREEN_HEIGHT,")");
SetVideoMode(0);
if (DEBUG_DISPLAY) printf("Video Mode is (%d)\n",GetVideoMode());
}
// set the graphics mode resolutions
GsInitGraph(SCREEN_WIDTH, SCREEN_HEIGHT, GsNONINTER|GsOFSGPU, 1, 0);
// set the top left coordinates of the two buffers in video memory
GsDefDispBuff(0, 0, 0, SCREEN_HEIGHT);
// init the ordering tables
WorldOrderingTable[0].length = OT_LENGTH;
WorldOrderingTable[1].length = OT_LENGTH;
WorldOrderingTable[0].org = OrderingTable[0];
WorldOrderingTable[1].org = OrderingTable[1];
GsClearOt(0,0,&WorldOrderingTable[0]);
GsClearOt(0,0,&WorldOrderingTable[1]);
printf("Graphics Initialised!\n");
}
http://www.psxdev.net/forum/viewtopic.php?f=51&t=316