PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
graph.h File Reference
#include <graph_vram.h>
+ Include dependency graph for graph.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GRAPH_MODE
 

Macros

#define GRAPH_MODE_AUTO   0
 
#define GRAPH_MODE_NTSC   1
 
#define GRAPH_MODE_PAL   2
 
#define GRAPH_MODE_HDTV_480P   3
 
#define GRAPH_MODE_HDTV_576P   4
 
#define GRAPH_MODE_HDTV_720P   5
 
#define GRAPH_MODE_HDTV_1080I   6
 
#define GRAPH_MODE_VGA_640_60   7
 
#define GRAPH_MODE_VGA_640_72   8
 
#define GRAPH_MODE_VGA_640_75   9
 
#define GRAPH_MODE_VGA_640_85   10
 
#define GRAPH_MODE_VGA_800_56   11
 
#define GRAPH_MODE_VGA_800_60   12
 
#define GRAPH_MODE_VGA_800_72   13
 
#define GRAPH_MODE_VGA_800_75   14
 
#define GRAPH_MODE_VGA_800_85   15
 
#define GRAPH_MODE_VGA_1024_60   16
 
#define GRAPH_MODE_VGA_1024_70   17
 
#define GRAPH_MODE_VGA_1024_75   18
 
#define GRAPH_MODE_VGA_1024_85   19
 
#define GRAPH_MODE_VGA_1280_60   20
 
#define GRAPH_MODE_VGA_1280_75   21
 
#define GRAPH_MODE_NONINTERLACED   0
 
#define GRAPH_MODE_INTERLACED   1
 
#define GRAPH_MODE_FIELD   0
 
#define GRAPH_MODE_FRAME   1
 
#define GRAPH_FIELD_EVEN   0
 
#define GRAPH_FIELD_ODD   1
 
#define GRAPH_DISABLE   0
 
#define GRAPH_ENABLE   1
 
#define GRAPH_GCONT_RGB   0
 
#define GRAPH_GCONT_YCRCB   1
 
#define GRAPH_CMOD_NTSC   2
 
#define GRAPH_CMOD_PAL   3
 
#define GRAPH_VALUE_RC1   0
 
#define GRAPH_VALUE_ALPHA   1
 
#define GRAPH_RC1_ALPHA   0
 
#define GRAPH_RC2_ALPHA   1
 
#define GRAPH_BLEND_RC2   0
 
#define GRAPH_BLEND_BGCOLOR   1
 

Functions

int graph_initialize (int fbp, int width, int height, int psm, int x, int y)
 
int graph_get_region (void)
 
float graph_aspect_ratio (void)
 
void graph_enable_output (void)
 
void graph_disable_output (void)
 
int graph_set_mode (int interlace, int mode, int ffmd, int flicker_filter)
 
int graph_set_screen (int x, int y, int width, int height)
 
void graph_set_framebuffer_filtered (int fbp, int width, int psm, int x, int y)
 
void graph_set_framebuffer (int context, int fbp, int width, int psm, int x, int y)
 
void graph_set_bgcolor (unsigned char r, unsigned char g, unsigned char b)
 
void graph_set_output (int rc1, int rc2, int alpha_select, int alpha_output, int blend_method, unsigned char alpha)
 
int graph_add_vsync_handler (int(*vsync_callback)())
 
void graph_remove_vsync_handler (int callback_id)
 
void graph_wait_hsync (void)
 
void graph_wait_vsync (void)
 
int graph_check_vsync (void)
 
void graph_start_vsync (void)
 
int graph_shutdown (void)
 

Variables

GRAPH_MODE graph_mode []
 

Detailed Description

Graph library

Definition in file graph.h.


Data Structure Documentation

◆ GRAPH_MODE

struct GRAPH_MODE

Definition at line 89 of file graph.h.

Data Fields
int x
int y
int width
int height
int mode

Macro Definition Documentation

◆ GRAPH_MODE_AUTO

#define GRAPH_MODE_AUTO   0

Automatic NTSC or PAL mode setting.

Definition at line 13 of file graph.h.

◆ GRAPH_MODE_NTSC

#define GRAPH_MODE_NTSC   1

256 x 224 to 640 x 448

Definition at line 15 of file graph.h.

◆ GRAPH_MODE_PAL

#define GRAPH_MODE_PAL   2

256 x 256 to 640 x 512

Definition at line 17 of file graph.h.

◆ GRAPH_MODE_HDTV_480P

#define GRAPH_MODE_HDTV_480P   3

720 x 480

Definition at line 19 of file graph.h.

◆ GRAPH_MODE_HDTV_576P

#define GRAPH_MODE_HDTV_576P   4

656 x 576

Definition at line 21 of file graph.h.

◆ GRAPH_MODE_HDTV_720P

#define GRAPH_MODE_HDTV_720P   5

1280 x 720

Definition at line 23 of file graph.h.

◆ GRAPH_MODE_HDTV_1080I

#define GRAPH_MODE_HDTV_1080I   6

1920 x 1080

Definition at line 25 of file graph.h.

◆ GRAPH_MODE_VGA_640_60

#define GRAPH_MODE_VGA_640_60   7

640 x 480 @ 60hz

Definition at line 27 of file graph.h.

◆ GRAPH_MODE_VGA_640_72

#define GRAPH_MODE_VGA_640_72   8

640 x 480 @ 72hz

Definition at line 29 of file graph.h.

◆ GRAPH_MODE_VGA_640_75

#define GRAPH_MODE_VGA_640_75   9

640 x 480 @ 75hz

Definition at line 31 of file graph.h.

◆ GRAPH_MODE_VGA_640_85

#define GRAPH_MODE_VGA_640_85   10

640 x 480 @ 85hz

Definition at line 33 of file graph.h.

◆ GRAPH_MODE_VGA_800_56

#define GRAPH_MODE_VGA_800_56   11

800 x 600 @ 56hz

Definition at line 35 of file graph.h.

◆ GRAPH_MODE_VGA_800_60

#define GRAPH_MODE_VGA_800_60   12

800 x 600 @ 60hz

Definition at line 37 of file graph.h.

◆ GRAPH_MODE_VGA_800_72

#define GRAPH_MODE_VGA_800_72   13

800 x 600 @ 72hz

Definition at line 39 of file graph.h.

◆ GRAPH_MODE_VGA_800_75

#define GRAPH_MODE_VGA_800_75   14

800 x 600 @ 75hz

Definition at line 41 of file graph.h.

◆ GRAPH_MODE_VGA_800_85

#define GRAPH_MODE_VGA_800_85   15

800 x 600 @ 85hz

Definition at line 43 of file graph.h.

◆ GRAPH_MODE_VGA_1024_60

#define GRAPH_MODE_VGA_1024_60   16

1024 x 768 @ 60hz

Definition at line 45 of file graph.h.

◆ GRAPH_MODE_VGA_1024_70

#define GRAPH_MODE_VGA_1024_70   17

1024 x 768 @ 70hz

Definition at line 47 of file graph.h.

◆ GRAPH_MODE_VGA_1024_75

#define GRAPH_MODE_VGA_1024_75   18

1024 x 768 @ 75hz

Definition at line 49 of file graph.h.

◆ GRAPH_MODE_VGA_1024_85

#define GRAPH_MODE_VGA_1024_85   19

1024 x 768 @ 85hz

Definition at line 51 of file graph.h.

◆ GRAPH_MODE_VGA_1280_60

#define GRAPH_MODE_VGA_1280_60   20

1280 x 1024 @ 60hz

Definition at line 53 of file graph.h.

◆ GRAPH_MODE_VGA_1280_75

#define GRAPH_MODE_VGA_1280_75   21

1280 x 1024 @ 75hz

Definition at line 55 of file graph.h.

◆ GRAPH_MODE_NONINTERLACED

#define GRAPH_MODE_NONINTERLACED   0

Definition at line 57 of file graph.h.

◆ GRAPH_MODE_INTERLACED

#define GRAPH_MODE_INTERLACED   1

Definition at line 58 of file graph.h.

◆ GRAPH_MODE_FIELD

#define GRAPH_MODE_FIELD   0

Definition at line 60 of file graph.h.

◆ GRAPH_MODE_FRAME

#define GRAPH_MODE_FRAME   1

Definition at line 61 of file graph.h.

◆ GRAPH_FIELD_EVEN

#define GRAPH_FIELD_EVEN   0

Definition at line 63 of file graph.h.

◆ GRAPH_FIELD_ODD

#define GRAPH_FIELD_ODD   1

Definition at line 64 of file graph.h.

◆ GRAPH_DISABLE

#define GRAPH_DISABLE   0

Generic use

Definition at line 67 of file graph.h.

◆ GRAPH_ENABLE

#define GRAPH_ENABLE   1

Definition at line 68 of file graph.h.

◆ GRAPH_GCONT_RGB

#define GRAPH_GCONT_RGB   0

Smode1 parameters

Definition at line 71 of file graph.h.

◆ GRAPH_GCONT_YCRCB

#define GRAPH_GCONT_YCRCB   1

Definition at line 72 of file graph.h.

◆ GRAPH_CMOD_NTSC

#define GRAPH_CMOD_NTSC   2

Definition at line 74 of file graph.h.

◆ GRAPH_CMOD_PAL

#define GRAPH_CMOD_PAL   3

Definition at line 75 of file graph.h.

◆ GRAPH_VALUE_RC1

#define GRAPH_VALUE_RC1   0

Alpha Blending value to use

Definition at line 78 of file graph.h.

◆ GRAPH_VALUE_ALPHA

#define GRAPH_VALUE_ALPHA   1

Definition at line 79 of file graph.h.

◆ GRAPH_RC1_ALPHA

#define GRAPH_RC1_ALPHA   0

Alpha output value

Definition at line 82 of file graph.h.

◆ GRAPH_RC2_ALPHA

#define GRAPH_RC2_ALPHA   1

Definition at line 83 of file graph.h.

◆ GRAPH_BLEND_RC2

#define GRAPH_BLEND_RC2   0

Alpha blending method

Definition at line 86 of file graph.h.

◆ GRAPH_BLEND_BGCOLOR

#define GRAPH_BLEND_BGCOLOR   1

Definition at line 87 of file graph.h.

Function Documentation

◆ graph_initialize()

int graph_initialize ( int  fbp,
int  width,
int  height,
int  psm,
int  x,
int  y 
)

Initializes a default NTSC/PAL mode with default settings.

Definition at line 6 of file graph.c.

References graph_enable_output(), graph_get_region(), graph_initialize(), graph_set_bgcolor(), graph_set_framebuffer_filtered(), graph_set_mode(), and graph_set_screen().

Referenced by graph_initialize().

◆ graph_get_region()

int graph_get_region ( void  )

Retrieves the PS2's region for automatic mode selection.

Definition at line 114 of file graph_mode.c.

References GetRomName(), graph_get_region(), GRAPH_MODE_NTSC, and GRAPH_MODE_PAL.

Referenced by graph_get_region(), and graph_initialize().

◆ graph_aspect_ratio()

float graph_aspect_ratio ( void  )

Returns an aspect ratio calculated from system setting, width, and height

Definition at line 400 of file graph_mode.c.

References configGetTvScreenType(), and graph_aspect_ratio().

Referenced by graph_aspect_ratio().

◆ graph_enable_output()

void graph_enable_output ( void  )

Sets a default output method.

Definition at line 315 of file graph_mode.c.

References GRAPH_BLEND_RC2, graph_enable_output(), GRAPH_RC1_ALPHA, and graph_set_output().

Referenced by graph_enable_output(), and graph_initialize().

◆ graph_disable_output()

void graph_disable_output ( void  )

Turns off the read circuits.

Definition at line 333 of file graph_mode.c.

References graph_disable_output(), and graph_set_output().

Referenced by graph_disable_output(), and graph_shutdown().

◆ graph_set_mode()

int graph_set_mode ( int  interlace,
int  mode,
int  ffmd,
int  flicker_filter 
)

◆ graph_set_screen()

int graph_set_screen ( int  x,
int  y,
int  width,
int  height 
)

Sets the screen dimensions for the read circuits.

Definition at line 186 of file graph_mode.c.

References GRAPH_MODE_AUTO, graph_set_screen(), GS_REG_DISPLAY1, and GS_REG_DISPLAY2.

Referenced by graph_initialize(), and graph_set_screen().

◆ graph_set_framebuffer_filtered()

void graph_set_framebuffer_filtered ( int  fbp,
int  width,
int  psm,
int  x,
int  y 
)

Sets the framebuffer attributes for the read circuits with filter.

Definition at line 268 of file graph_mode.c.

References graph_set_framebuffer_filtered(), GS_REG_DISPFB1, and GS_REG_DISPFB2.

Referenced by graph_initialize(), and graph_set_framebuffer_filtered().

◆ graph_set_framebuffer()

void graph_set_framebuffer ( int  context,
int  fbp,
int  width,
int  psm,
int  x,
int  y 
)

Sets the framebuffer attributes for the read circuits.

Definition at line 278 of file graph_mode.c.

References graph_set_framebuffer(), GS_REG_DISPFB1, and GS_REG_DISPFB2.

Referenced by graph_set_framebuffer().

◆ graph_set_bgcolor()

void graph_set_bgcolor ( unsigned char  r,
unsigned char  g,
unsigned char  b 
)

Sets the background color for merge circuit.

Definition at line 297 of file graph_mode.c.

References graph_set_bgcolor(), and GS_REG_BGCOLOR.

Referenced by graph_initialize(), and graph_set_bgcolor().

◆ graph_set_output()

void graph_set_output ( int  rc1,
int  rc2,
int  alpha_select,
int  alpha_output,
int  blend_method,
unsigned char  alpha 
)

Sets the read circuits and merge cicuit.

Definition at line 304 of file graph_mode.c.

References graph_set_output(), and GS_REG_PMODE.

Referenced by graph_disable_output(), graph_enable_output(), and graph_set_output().

◆ graph_add_vsync_handler()

int graph_add_vsync_handler ( int(*)()  vsync_callback)

Add a vsync interrupt handler

Definition at line 29 of file graph.c.

References graph_add_vsync_handler().

Referenced by graph_add_vsync_handler().

◆ graph_remove_vsync_handler()

void graph_remove_vsync_handler ( int  callback_id)

Remove a vsync interrupt handler

Definition at line 46 of file graph.c.

References graph_remove_vsync_handler().

Referenced by graph_remove_vsync_handler().

◆ graph_wait_hsync()

void graph_wait_hsync ( void  )

Starts a horizontal sync event and waits

Definition at line 74 of file graph.c.

References graph_wait_hsync(), and GS_REG_CSR.

Referenced by graph_wait_hsync().

◆ graph_wait_vsync()

void graph_wait_vsync ( void  )

Starts a vertical sync event and waits.

Definition at line 99 of file graph.c.

References graph_wait_vsync(), and GS_REG_CSR.

Referenced by graph_wait_vsync().

◆ graph_check_vsync()

int graph_check_vsync ( void  )

Checks if a vertical sync event is currently generated.

Definition at line 85 of file graph.c.

References graph_check_vsync(), and GS_REG_CSR.

Referenced by graph_check_vsync().

◆ graph_start_vsync()

void graph_start_vsync ( void  )

Starts a vertical sync event and returns immediately.

Definition at line 92 of file graph.c.

References graph_start_vsync(), and GS_REG_CSR.

Referenced by graph_start_vsync().

◆ graph_shutdown()

int graph_shutdown ( void  )

Shut down the graphics library and hardware.

Definition at line 431 of file graph_mode.c.

References graph_disable_output(), graph_shutdown(), and GS_REG_CSR.

Referenced by graph_shutdown().

Variable Documentation

◆ graph_mode

GRAPH_MODE graph_mode[]
extern

Definition at line 12 of file graph_mode.c.