ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
libgs.c File Reference
#include <errno.h>
#include <stdio.h>
#include <kernel.h>
#include <libgs.h>
#include "internal.h"
+ Include dependency graph for libgs.c:

Go to the source code of this file.

Functions

GsGParam_tGsGetGParam (void)
 
void GsResetGraph (s16 mode, s16 interlace, s16 omode, s16 ffmode)
 
void GsSetCRTCSettings (u64 settings, u8 alpha_value)
 

Variables

QWORD GsPrimWorkArea []
 
static GsGParam_t gp_15 ={GS_INTERLACED, GS_MODE_NTSC, GS_FFMD_FRAME, 3}
 

Function Documentation

◆ GsGetGParam()

GsGParam_t* GsGetGParam ( void  )

Definition at line 24 of file libgs.c.

25 {
26  return &gp_15;
27 }
static GsGParam_t gp_15
Definition: libgs.c:22

References gp_15.

Referenced by GsResetGraph(), and GsSetDefaultDisplayEnv().

◆ GsResetGraph()

void GsResetGraph ( s16  mode,
s16  interlace,
s16  omode,
s16  ffmode 
)

Definition at line 29 of file libgs.c.

30 {
31  GsGParam_t *pGParams;
32 
33  switch(mode){
34  case GS_INIT_RESET:
35  GsDmaInit(); //It seems like the Sony developers reset the GIF DMA channel with their libdma library, but a lot of homebrew GS libraries will do this on their own.
36 
37  pGParams=GsGetGParam();
39  pGParams->ffmode=ffmode;
40  pGParams->interlace=interlace;
41  pGParams->omode=omode;
42  pGParams->version=GS_GET_CSR_gs_rev_number>>16;
43 
44  GsPutIMR(0xFF00);
45 
46  SetGsCrt(interlace&1, omode&0xFF, ffmode&1);
48  break;
49  case GS_INIT_DRAW_RESET:
51  break;
52  /* There is a mode 5 present in the Sony sceGsResetGraph, but is not documented. It seems to change the video mode without resetting anything. */
53  }
54 }
void SetGsCrt(s16 interlace, s16 pal_ntsc, s16 field)
u64 GsPutIMR(u64 imr)
void GsDmaInit(void)
Definition: dma.c:58
void GsSetCRTCSettings(u64 settings, u8 alpha_value)
Definition: libgs.c:56
GsGParam_t * GsGetGParam(void)
Definition: libgs.c:24
#define CRTC_SETTINGS_DEFAULT1
Definition: libgs.h:1884
#define GS_GET_CSR_gs_rev_number
Definition: libgs.h:1347
#define GS_SET_CSR_flush(val)
Definition: libgs.h:1303
#define GS_SET_CSR_reset(val)
Definition: libgs.h:1306
#define GS_INIT_DRAW_RESET
Definition: libgs.h:35
#define GS_INIT_RESET
Definition: libgs.h:33
s32 mode
Definition: rpc_client.c:15
u8 version
Definition: libgs.h:29
u8 interlace
Definition: libgs.h:23
u8 ffmode
Definition: libgs.h:27
u8 omode
Definition: libgs.h:25

References CRTC_SETTINGS_DEFAULT1, GsGParam_t::ffmode, GS_GET_CSR_gs_rev_number, GS_INIT_DRAW_RESET, GS_INIT_RESET, GS_SET_CSR_flush, GS_SET_CSR_reset, GsDmaInit(), GsGetGParam(), GsPutIMR(), GsSetCRTCSettings(), GsGParam_t::interlace, mode, GsGParam_t::omode, SetGsCrt(), and GsGParam_t::version.

◆ GsSetCRTCSettings()

void GsSetCRTCSettings ( u64  settings,
u8  alpha_value 
)

Definition at line 56 of file libgs.c.

57 {
58  *((vu64 *)(gs_p_pmode)) = (settings|((u64)(0x001) << 2)|((u64)(alpha_value) << 8));
59 }
#define gs_p_pmode
Definition: libgs.h:190
volatile u64 vu64
Definition: tamtypes.h:39
unsigned long u64
Definition: tamtypes.h:34

References gs_p_pmode.

Referenced by GsResetGraph(), and SelectDisplayContext().

Variable Documentation

◆ gp_15

Definition at line 22 of file libgs.c.

Referenced by GsGetGParam().

◆ GsPrimWorkArea

QWORD GsPrimWorkArea[]
extern

Definition at line 18 of file packets.c.