PSXSDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Data Structures | Macros | Enumerations | Functions | Variables
psxgpu.h File Reference

Go to the source code of this file.

Data Structures

struct  GsPoly3
 Monochrome 3 point polygon. More...
 
struct  GsPoly4
 Monochrome 4 point polygon. More...
 
struct  GsTPoly3
 Textured 3 point polygon. More...
 
struct  GsTPoly4
 Textured 4 point polygon. More...
 
struct  GsGPoly3
 Graduated 3 point polygon. More...
 
struct  GsGPoly4
 Graduated 4 point polygon. More...
 
struct  GsGTPoly3
 Graduated textured 3 point polygon. More...
 
struct  GsGTPoly4
 Graduated textured 4 point polygon. More...
 
struct  GsLine
 Monochrome line. More...
 
struct  GsDot
 Dot (pixel) More...
 
struct  GsGLine
 Graduated line. More...
 
struct  GsSprite
 Sprite. More...
 
struct  GsRectangle
 Rectangle. More...
 
struct  GsPolyLine
 
struct  GsGPolyLine
 
struct  GsDrawEnv
 Drawing environment. More...
 
struct  GsDispEnv
 Display environment. More...
 
struct  GsImage
 Image. More...
 

Macros

#define NORMAL_LUMINANCE   128
 This is the luminance factor with which images are drawn as they are stored.
 
#define NORMAL_LUMINOSITY   NORMAL_LUMINANCE
 
#define COLORMODE(x)   x&3
 Macro to specify texture color mode, takes a value from psx_gpu_texmodes.
 
#define TRANS_MODE(x)   ((x&3)<<2)
 Macro to specify translucency/semitransparency mode, where x can be a value from 0 to 3.
 
#define ENABLE_TRANS   (1<<4)
 Enable semi-transparency processing for the primitive.
 
#define H_FLIP   (1<<5)
 Enable horizontal flipping for the primitive.
 
#define V_FLIP   (1<<6)
 Enable vertical flipping for the primitive.
 
#define MASK_SET   1
 
#define MASK_IGNORE   2
 
#define SCALE_ONE   4096
 One scaling unit.
 
#define ROTATE_ONE   4096
 One rotation unit.
 
#define PRFONT_WRAP   1
 
#define PRFONT_CENTER   2
 
#define PRFONT_RIGHT   4
 
#define PRFONT_SCALE   8
 
#define PRFONT_UNIXLF   16
 
#define PRFONT_COLOR   32
 
#define prfont_get_fx(i)   ((short)(i & 0xffff))
 
#define prfont_get_fy(i)   ((short)((i >> 16) & 0xffff))
 
#define gs_get_tpage_num(x, y)   ((x/64)+((y/256)*16))
 Macro to get a texture page number from a coordinate in VRAM.
 
#define gs_get_tpage_u(x)   (x&0x3f)
 Macro to get an horizontal texture offset from a X coordinate in VRAM.
 
#define gs_get_tpage_v(y)   (y&0xff)
 Macro to get a vertical texture offset from a Y coordinate in VRAM.
 
#define gs_rgb_to_psx(r, g, b)   ((r>>3)|((g>>3)<<5)|((b>>3)<<10))
 This macro converts a RGB 888 color to PlayStation color format.
 
#define gs_rgba_to_psx(r, g, b, a)   ((r>>3)|((g>>3)<<5)|((b>>3)<<10)|(a==0?0:1))
 This macro converts a RGB 888 color (a color whose color components have an intensity between 0 and 255) to PlayStation color format, considering an alpha bit.
 

Enumerations

enum  psx_gpu_texmodes { COLORMODE_4BPP, COLORMODE_8BPP, COLORMODE_16BPP, COLORMODE_24BPP }
 Map. More...
 
enum  psx_gpu_vmodes { VMODE_NTSC, VMODE_PAL }
 Television video modes. More...
 

Functions

void GsInit (void)
 Initializes the GPU.
 
void GsInitEx (unsigned int flags)
 Initializes the GPU.
 
void GsReset (void)
 Resets the GPU.
 
void GsEnableDisplay (int enable)
 Enables the display (i.e.
 
int GsSetVideoMode (int width, int height, int video_mode)
 Sets a video mode and enables the display.
 
int GsSetVideoModeEx (int width, int height, int video_mode, int rgb24, int inter, int reverse)
 Works like GsSetVideoMode() but offers more control.
 
void GsSetList (unsigned int *listptr)
 Assigns the internal pointer to the primitive list to the desired one, and resets the linked list position counter.
 
void GsSetListEx (unsigned int *listptr, unsigned int listpos)
 Assigns the internal pointer to the primitive list to the desired one, an sets the linked list position counter to the specified value.
 
void GsDrawList (void)
 Draws the primitive list.
 
void GsDrawListPIO (void)
 Draws the primitive list using port I/O access.
 
void GsSetAutoWait (void)
 Makes non-blocking gpu functions like GsDrawList() wait for completion.
 
void GsSortPoly3 (GsPoly3 *poly3)
 Adds a monochrome 3 point polygon to the packet list.
 
void GsSortPoly4 (GsPoly4 *poly4)
 Adds a monochrome 4 point polygon to the packet list.
 
void GsSortTPoly3 (GsTPoly3 *tpoly3)
 Adds a textured 3 point polygon to the packet list.
 
void GsSortTPoly4 (GsTPoly4 *tpoly4)
 Adds a textured 4 point polygon to the packet list.
 
void GsSortGPoly3 (GsGPoly3 *poly3)
 Adds a gradated 3 point polygon to the packet list.
 
void GsSortGPoly4 (GsGPoly4 *poly4)
 Adds a gradated 4 point polygon to the packet list.
 
void GsSortGTPoly3 (GsGTPoly3 *tpoly3)
 Adds a gradated textured 3 point polygon to the packet list.
 
void GsSortGTPoly4 (GsGTPoly4 *tpoly4)
 Adds a gradated 4 point polygon to the packet list.
 
void GsSortLine (GsLine *line)
 Adds a monochrome line to the packet list.
 
void GsSortGLine (GsGLine *line)
 Adds a gradated line to the packet list.
 
void GsSortDot (GsDot *dot)
 Adds a dot (pixel) to the packet list.
 
void GsSortSprite (GsSprite *sprite)
 Adds a sprite to the packet list.
 
void GsSortSimpleSprite (GsSprite *sprite)
 Always adds a REAL sprite to the packet list.
 
void GsSortRectangle (GsRectangle *rectangle)
 Adds a rectangle to the packet list.
 
void MoveImage (int src_x, int src_y, int dst_x, int dst_y, int w, int h)
 Moves image data from a part of the framebuffer to another.
 
void LoadImage (void *img, int x, int y, int w, int h)
 Loads image data into framebuffer memory.
 
void DrawFBRect (int x, int y, int w, int h, int r, int g, int b)
 Draws a rectangle in the framebuffer, without considering drawing and display environments (i.e.
 
void GsSetDrawEnv (GsDrawEnv *drawenv)
 Set drawing environment.
 
void GsSetDispEnv (GsDispEnv *dispenv)
 Set display environment.
 
void GsSetMasking (unsigned char flag)
 Sets masking settings.
 
unsigned int GsListPos (void)
 Return pointer position in linked list.
 
void gpu_ctrl (unsigned int command, unsigned int param)
 Three functions which send data to the control port and to the data port.
 
void gpu_data (unsigned int data)
 
void gpu_data_ctrl (unsigned int command, unsigned int param)
 
int GsImageFromTim (GsImage *image, void *timdata)
 Puts information about a TIM image passed in a buffer in a GsImage structure.
 
void GsUploadImage (GsImage *image)
 Uploads an image described by a GsImage structure to video memory.
 
int GsSpriteFromImage (GsSprite *sprite, GsImage *image, int do_upload)
 Fills a GsSprite structure with information from an image described by a GsImage structure, then optionally uploads data to video memory.
 
int GsIsDrawing (void)
 Checks if the GPU is drawing.
 
int GsIsWorking (void)
 Checks if the GPU is working.
 
void GsClearMem (void)
 Clear Video RAM.
 
void GsLoadFont (int fb_x, int fb_y, int cx, int cy)
 Loads the built-in 8x8 font in Video RAM at the specified coordinates.
 
unsigned int GsPrintFont (int x, int y, const char *fmt,...)
 Prints string using 8x8 font at screen coordinates x, y.
 
unsigned int GsVPrintFont (int x, int y, const char *fmt, va_list ap)
 Prints string using 8x8 font at screen coordinates x, y Apart from using a variable argument list, this function is identical to GsPrintFont()
 
void GsSetFont (int fb_x, int fb_y, int cx, int cy)
 Change font coordinates without reloading it.
 
void GsSetFontAttrib (unsigned int flags)
 This is a function that sets an internal variable flags should be specified as an OR mask.
 
void GsSetDrawEnvSimple (int x, int y, int w, int h)
 Sets drawing environment Enables drawing on the display area, disables dithering and disables all masking flags by default.
 
void GsSetDispEnvSimple (int x, int y)
 Sets display environment.
 
unsigned int PRFONT_SCALEX (int i)
 
unsigned int PRFONT_SCALEY (int i)
 
unsigned int PRFONT_RL (unsigned char f)
 
unsigned int PRFONT_GL (unsigned char f)
 
unsigned int PRFONT_BL (unsigned char f)
 
void GsSortCls (int r, int g, int b)
 Clear the entire drawing area with specified color.
 
void GsRotateVector (int x_a, int y_a, int z_a, double *v, double *n)
 This function can rotate a vector about the X, Y and Z axes If you don't want to rotate a vector about an axis, pass 0 as angle to that axis.
 
void GsSortPolyLine (GsPolyLine *line)
 Adds a monochrome polyline to the packet list.
 
void GsSortGPolyLine (GsGPolyLine *line)
 Adds a gradated polyline to the packet list.
 

Variables

unsigned short GsScreenW
 This global variable reports the current screen width, as set by GsSetVideoMode().
 
unsigned short GsScreenH
 This global variable reports the current screen height, as set by GsSetVideoMode().
 
unsigned char GsScreenM
 This global variable reports the current screen color mode (PAL or NTSC), as set by GsSetVideoMode().
 
unsigned short GsCurDrawEnvW
 This global variable reports the width of the current drawing environment.
 
unsigned short GsCurDrawEnvH
 This global variable reports the height of the current drawing environment.
 

Macro Definition Documentation

#define COLORMODE (   x)    x&3

Macro to specify texture color mode, takes a value from psx_gpu_texmodes.

#define ENABLE_TRANS   (1<<4)

Enable semi-transparency processing for the primitive.

#define gs_get_tpage_num (   x,
 
)    ((x/64)+((y/256)*16))

Macro to get a texture page number from a coordinate in VRAM.

Attention
Macros by their definition do not like being passed invalid values.
Parameters
xX coordinate (0-1023)
yY coordinate (0-511)
#define gs_get_tpage_u (   x)    (x&0x3f)

Macro to get an horizontal texture offset from a X coordinate in VRAM.

Parameters
xX coordinate (0-1023)
#define gs_get_tpage_v (   y)    (y&0xff)

Macro to get a vertical texture offset from a Y coordinate in VRAM.

Parameters
yY coordinate (0-511)
#define gs_rgb_to_psx (   r,
  g,
 
)    ((r>>3)|((g>>3)<<5)|((b>>3)<<10))

This macro converts a RGB 888 color to PlayStation color format.

Parameters
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)
#define gs_rgba_to_psx (   r,
  g,
  b,
 
)    ((r>>3)|((g>>3)<<5)|((b>>3)<<10)|(a==0?0:1))

This macro converts a RGB 888 color (a color whose color components have an intensity between 0 and 255) to PlayStation color format, considering an alpha bit.

If the alpha bit is non-zero, the STP bit in the color is set and will be considered for PlayStation translucency effects.

Parameters
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)
aAlpha bit (STP/semitransparency bit)
#define H_FLIP   (1<<5)

Enable horizontal flipping for the primitive.

#define MASK_IGNORE   2
#define MASK_SET   1
#define NORMAL_LUMINANCE   128

This is the luminance factor with which images are drawn as they are stored.

(i.e. without applying lighting)

NORMAL_LUMINOSITY (sic) is kept for backward compatibility, but "luminosity" is an incorrect term here.

#define NORMAL_LUMINOSITY   NORMAL_LUMINANCE
#define PRFONT_CENTER   2
#define PRFONT_COLOR   32
#define prfont_get_fx (   i)    ((short)(i & 0xffff))
#define prfont_get_fy (   i)    ((short)((i >> 16) & 0xffff))
#define PRFONT_RIGHT   4
#define PRFONT_SCALE   8
#define PRFONT_UNIXLF   16
#define PRFONT_WRAP   1
#define ROTATE_ONE   4096

One rotation unit.

#define SCALE_ONE   4096

One scaling unit.

#define TRANS_MODE (   x)    ((x&3)<<2)

Macro to specify translucency/semitransparency mode, where x can be a value from 0 to 3.

If a pixel in image data to be drawn has the STP bit set, semitransparency processing is enabled for that pixel.

When the color is black (RGB=0,0,0) STP is processed differently from when it is not black.

The table below shows the differences:

Color STP bit Processing off Processing on
Black 0 Transparent Transparent
Black 1 Non-transparent Non-Transparent
Not black 0 Non-Transparent Non-Transparent
Not black 1 Non-Transparent Transparent

If the image pixel is semi-transparent (STP bit set) and not black, the formulas for the final pixel color are the following:

Mode From framebuffer pixelFrom image pixel
0 +50% +50%
1 +100% +100%
2 +100% -100%
3 +100% +25%

The final color component values do not underflow or overflow, they simply saturate at 0 or 255.

#define V_FLIP   (1<<6)

Enable vertical flipping for the primitive.

Enumeration Type Documentation

Map.

Texture color modes.

Enumerator:
COLORMODE_4BPP 

4-bit color mode

COLORMODE_8BPP 

8-bit color mode

COLORMODE_16BPP 

16-bit color mode

COLORMODE_24BPP 

24-bit color mode

Television video modes.

Enumerator:
VMODE_NTSC 

NTSC video mode, 60Hz.

VMODE_PAL 

PAL video mode, 50Hz.

Function Documentation

void DrawFBRect ( int  x,
int  y,
int  w,
int  h,
int  r,
int  g,
int  b 
)

Draws a rectangle in the framebuffer, without considering drawing and display environments (i.e.

it does so in an absolute way)

Parameters
xTop-left X coordinate of area
yTop-left Y coordinate of area
wArea width
hArea height
rRed (0 - 255)
gGreen (0 - 255)
bBlue (0 - 255)
void gpu_ctrl ( unsigned int  command,
unsigned int  param 
)

Three functions which send data to the control port and to the data port.

void gpu_data ( unsigned int  data)
void gpu_data_ctrl ( unsigned int  command,
unsigned int  param 
)
void GsClearMem ( void  )

Clear Video RAM.

void GsDrawList ( void  )

Draws the primitive list.

This also has the effect of resetting the current drawing list position.

void GsDrawListPIO ( void  )

Draws the primitive list using port I/O access.

GsDrawList() uses DMA to transfer the primitive data in the linked list to the GPU.

This function which is of main interest to low-level programmers, uses GPU port I/O access instead, and it is slower (as reads and writes must be done by the main CPU), but works in all situations, even when you can't get DMA working.

This function due to its nature is blocking, and always waits for completion.

void GsEnableDisplay ( int  enable)

Enables the display (i.e.

generation of video output).

Unless you are doing low-level GPU programming, you don't need to call this function; the display is enabled automatically by GsSetVideoMode().

Parameters
enableIf TRUE (>=1) the display will be enabled, if FALSE (== 0) it will be disabled
int GsImageFromTim ( GsImage image,
void *  timdata 
)

Puts information about a TIM image passed in a buffer in a GsImage structure.

void GsInit ( void  )

Initializes the GPU.

Same as GsInitEx(0)

The display is left disabled. You can enable it with GsEnableDisplay() or more preferably with GsSetVideoMode()

void GsInitEx ( unsigned int  flags)

Initializes the GPU.

The display is left disabled. You can enable it with GsEnableDisplay() or more preferably with GsSetVideoMode()

Parameters
flagsFlag bitmask
int GsIsDrawing ( void  )

Checks if the GPU is drawing.

Returns
1 if GPU is drawing, 0 otherwise
int GsIsWorking ( void  )

Checks if the GPU is working.

Alias of GsIsDrawing()

Returns
1 if GPU is working, 0 otherwise.
unsigned int GsListPos ( void  )

Return pointer position in linked list.

Returns
Pointer position in linked list
void GsLoadFont ( int  fb_x,
int  fb_y,
int  cx,
int  cy 
)

Loads the built-in 8x8 font in Video RAM at the specified coordinates.

Specifying cx and cy as -1 will not load the black&white CLUT to video memory. Use GsSetFont() to specify clut x and clut y in that case.

The font occupies a space of 16x128 pixels in 16-bit mode, and 64x128 in 4-bit mode.

Parameters
fb_xX coordinate in framebuffer
fb_yY coordinate in framebuffer
cxX coordinate of black/white CLUT in framebuffer
cyY coordinate of black/white CLUT in framebuffer
unsigned int GsPrintFont ( int  x,
int  y,
const char *  fmt,
  ... 
)

Prints string using 8x8 font at screen coordinates x, y.

Parameters
xX coordinate
yY coordinate
fmtformat (like *printf())
Returns
Position identifier.
void GsReset ( void  )

Resets the GPU.

void GsRotateVector ( int  x_a,
int  y_a,
int  z_a,
double *  v,
double *  n 
)

This function can rotate a vector about the X, Y and Z axes If you don't want to rotate a vector about an axis, pass 0 as angle to that axis.

It is correct to pass the same argument to v and n, as calculations are first done in an internal buffer and then stored in the output array

Parameters
x_aNumber of degrees (0-359) to which the vector should be rotated about the X axis
y_aNumber of degrees (0-359) to which the vector should be rotated about the Y axis
z_aNumber of degrees (0-359) to which the vector should be rotated about the Z axis
vPointer to an array of coordinates for the source vector
nPointer to destination array for the coordinates of the rotated vector
void GsSetAutoWait ( void  )

Makes non-blocking gpu functions like GsDrawList() wait for completion.

Removes the need to use GsIsDrawing()/GsIsWorking()

void GsSetDispEnv ( GsDispEnv dispenv)

Set display environment.

Parameters
dispenvPointer to display environment structure
void GsSetDispEnvSimple ( int  x,
int  y 
)

Sets display environment.

Parameters
xTop-left X coordinate of framebuffer area to display
yTop-left Y coordinate of framebuffer area to display
void GsSetDrawEnv ( GsDrawEnv drawenv)

Set drawing environment.

Parameters
drawenvPointer to drawing environment structure
void GsSetDrawEnvSimple ( int  x,
int  y,
int  w,
int  h 
)

Sets drawing environment Enables drawing on the display area, disables dithering and disables all masking flags by default.

Parameters
xTop-left X coordinate of framebuffer area to use for drawing
yTop-left Y coordinate of framebuffer area to use for drawing
wWidth of area
hHeight of area
void GsSetFont ( int  fb_x,
int  fb_y,
int  cx,
int  cy 
)

Change font coordinates without reloading it.

void GsSetFontAttrib ( unsigned int  flags)

This is a function that sets an internal variable flags should be specified as an OR mask.

to set the wrap and scale attributes, with X scaling factor 2 and Y scaling factor 3, for example: GsSetFontAttrib(PRFONT_WRAP | PRFONT_SCALE | PRFONT_SCALEX(2) | PRFONT_SCALEY(3));

to remove all attributes (normal printing):

GsSetFontAttrib(0);

PRFONT_WRAP can't coexist with PRFONT_CENTER or PRFONT_RIGHT PRFONT_CENTER and PRFONT_RIGHT are justifying attributes and as such they are mutually exclusive - they cannot coexist with each other. Specifying both will give priority to PRFONT_CENTER.

Attribute list:

PRFONT_WRAP - Wrap to next row when the text would fall off the screen Ideal for debug PRFONT_SCALE - Enable font scaling PRFONT_SCALEX(i) - Specifies the factor "i" as the X scaling factor This has the same meaning as a sprite's scaling factor PRFONT_SCALEY(i) - Specify the factor "i" as the Y scaling factor This has the same meaning as a sprite's scaling factor PRFONT_RIGHT - Justifies text to the right PRFONT_CENTER - Justifies text at the center PRFONT_RL(f) - Luminance factor for the red component PRFONT_GL(f) - Luminance factor for the green component PRFONT_BL(f) - Luminance factor for the blue component

void GsSetList ( unsigned int *  listptr)

Assigns the internal pointer to the primitive list to the desired one, and resets the linked list position counter.

The memory address specified by your pointer has to have enough space free to contain all the packets which you want to send.

Parameters
listptrPointer to primitive list
void GsSetListEx ( unsigned int *  listptr,
unsigned int  listpos 
)

Assigns the internal pointer to the primitive list to the desired one, an sets the linked list position counter to the specified value.

The memory address specified by your pointer has to have enough space free to contain all the packets which you want to send, and you must ensure that the specified position is not out of bounds.

Parameters
listptrPointer to primitive list
listposList position
void GsSetMasking ( unsigned char  flag)

Sets masking settings.

Parameters
flagBitwise flags
int GsSetVideoMode ( int  width,
int  height,
int  video_mode 
)

Sets a video mode and enables the display.

It does so in a quicker way than GsSetVideoModeEx(), which wants more arguments but offers greater control

Parameters
widthWidth
  • 640, 384, 320 and 256 are supported by the PlayStation hardware.
heightHeight
  • 480 and 240 are supported by the PlayStation hardware. You probably want to use GsSetVideoModeEx() if you set 480 here, because this function doesn't enable interlacing.
video_modeVideo mode
  • VMODE_NTSC for NTSC, VMODE_PAL for PAL
Returns
1 on success, 0 on failure (such as unavailable video mode)
int GsSetVideoModeEx ( int  width,
int  height,
int  video_mode,
int  rgb24,
int  inter,
int  reverse 
)

Works like GsSetVideoMode() but offers more control.

Interlaced, 24-bit RGB, and "reverse" flags can be specified.

Parameters
widthWidth
  • 640, 384, 320 and 256 are supported by the PlayStation hardware.
heightHeight
  • 480 and 240 are supported by the PlayStation hardware.
video_modeVideo mode
  • VMODE_NTSC for NTSC, VMODE_PAL for PAL
rgb2424-bit RGB mode
  • If TRUE (!=0) enables the very rarely used 24-bit color mode. Unless you're very creative, don't enable this.
interInterlacing
  • If TRUE (!=0) enables interlacing. If you set the height paramater to 480, and you want to display your program on a real television screen, you must enable this.
reverseReverse??
  • The function of this is not really known. Stay safe and set this to FALSE (0).
Returns
1 on success, 0 on failure (such as unavailable video mode)
void GsSortCls ( int  r,
int  g,
int  b 
)

Clear the entire drawing area with specified color.

Parameters
rRed (0 - 255)
gGreen (0 - 255)
bBlue (0 - 255)
void GsSortDot ( GsDot dot)

Adds a dot (pixel) to the packet list.

Parameters
dotPointer to structure for dot
void GsSortGLine ( GsGLine line)

Adds a gradated line to the packet list.

Parameters
linePointer to structure for gradated line
void GsSortGPoly3 ( GsGPoly3 poly3)

Adds a gradated 3 point polygon to the packet list.

Parameters
poly3Pointer to structure for gradated 3 point polygon
void GsSortGPoly4 ( GsGPoly4 poly4)

Adds a gradated 4 point polygon to the packet list.

Parameters
poly4Pointer to structure for gradated 4 point polygon
void GsSortGPolyLine ( GsGPolyLine line)

Adds a gradated polyline to the packet list.

Parameters
linePointer to structure for monochrome line
void GsSortGTPoly3 ( GsGTPoly3 tpoly3)

Adds a gradated textured 3 point polygon to the packet list.

Parameters
tpoly3Pointer to structure for textured 3 point polygon
void GsSortGTPoly4 ( GsGTPoly4 tpoly4)

Adds a gradated 4 point polygon to the packet list.

Parameters
tpoly4Pointer to structure for textured 4 point polygon
void GsSortLine ( GsLine line)

Adds a monochrome line to the packet list.

Parameters
linePointer to structure for monochrome line
void GsSortPoly3 ( GsPoly3 poly3)

Adds a monochrome 3 point polygon to the packet list.

Parameters
poly3Pointer to structure for monochrome 3 point polygon
void GsSortPoly4 ( GsPoly4 poly4)

Adds a monochrome 4 point polygon to the packet list.

Parameters
poly4Pointer to structure for monochrome 4 point polygon
void GsSortPolyLine ( GsPolyLine line)

Adds a monochrome polyline to the packet list.

Parameters
linePointer to structure for monochrome polyline
void GsSortRectangle ( GsRectangle rectangle)

Adds a rectangle to the packet list.

Parameters
rectanglePointer to structure for rectangle
void GsSortSimpleSprite ( GsSprite sprite)

Always adds a REAL sprite to the packet list.

  • GsSortSprite() on the other hand checks for scaling and flipping, which are not supported by the "sprite" primitive on the PlayStation, but instead are done by using a textured 4-point polygon accordingly. GsSortSprite() only uses the sprite primitive when all the attributes can be done with a "sprite" primitive as well.
Parameters
spritePointer to structure for sprite
void GsSortSprite ( GsSprite sprite)

Adds a sprite to the packet list.

Parameters
spritePointer to structure for sprite
void GsSortTPoly3 ( GsTPoly3 tpoly3)

Adds a textured 3 point polygon to the packet list.

Parameters
tpoly3Pointer to structure for textured 3 point polygon
void GsSortTPoly4 ( GsTPoly4 tpoly4)

Adds a textured 4 point polygon to the packet list.

Parameters
tpoly4Pointer to structure for textured 4 point polygon
int GsSpriteFromImage ( GsSprite sprite,
GsImage image,
int  do_upload 
)

Fills a GsSprite structure with information from an image described by a GsImage structure, then optionally uploads data to video memory.

Sprite coordinates are set to 0.

void GsUploadImage ( GsImage image)

Uploads an image described by a GsImage structure to video memory.

unsigned int GsVPrintFont ( int  x,
int  y,
const char *  fmt,
va_list  ap 
)

Prints string using 8x8 font at screen coordinates x, y Apart from using a variable argument list, this function is identical to GsPrintFont()

Parameters
xX coordinate
yY coordinate
fmtformat (like *printf())
apVariable argument list
Returns
Position identifier.
void LoadImage ( void *  img,
int  x,
int  y,
int  w,
int  h 
)

Loads image data into framebuffer memory.

Parameters
imgPointer to raw image data
xTop-left X coordinate of destination area
yTop-left Y coordinate of destination area
wWidth of image data
hHeight of image data
void MoveImage ( int  src_x,
int  src_y,
int  dst_x,
int  dst_y,
int  w,
int  h 
)

Moves image data from a part of the framebuffer to another.

Actually it does a copy.

Parameters
src_xTop-left X coordinate of source area
src_yTop-left Y coordinate of source area
dst_xTop-left X coordinate of destination area
dst_yTop-left Y coordinate of destination area
wWidth of area
hHeight of area
unsigned int PRFONT_BL ( unsigned char  f)
unsigned int PRFONT_GL ( unsigned char  f)
unsigned int PRFONT_RL ( unsigned char  f)
unsigned int PRFONT_SCALEX ( int  i)
unsigned int PRFONT_SCALEY ( int  i)

Variable Documentation

unsigned short GsCurDrawEnvH

This global variable reports the height of the current drawing environment.

unsigned short GsCurDrawEnvW

This global variable reports the width of the current drawing environment.

unsigned short GsScreenH

This global variable reports the current screen height, as set by GsSetVideoMode().

Do not modify.

unsigned char GsScreenM

This global variable reports the current screen color mode (PAL or NTSC), as set by GsSetVideoMode().

You can use the values in the psx_gpu_vmodes enum to evaluate this. Do not modify.

unsigned short GsScreenW

This global variable reports the current screen width, as set by GsSetVideoMode().

Do not modify.