ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
libgs.c
Go to the documentation of this file.
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # (c) 2009 Lion
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
11 #include <errno.h>
12 #include <stdio.h>
13 #include <kernel.h>
14 #include <libgs.h>
15 
16 #include "internal.h"
17 
18 extern QWORD GsPrimWorkArea[];
19 
20 /* Initialization functions. */
21 
23 
25 {
26  return &gp_15;
27 }
28 
29 void GsResetGraph(s16 mode, s16 interlace, s16 omode, s16 ffmode)
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 }
55 
56 void GsSetCRTCSettings(u64 settings, u8 alpha_value)
57 {
58  *((vu64 *)(gs_p_pmode)) = (settings|((u64)(0x001) << 2)|((u64)(alpha_value) << 8));
59 }
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
QWORD GsPrimWorkArea[]
Definition: packets.c:18
void GsResetGraph(s16 mode, s16 interlace, s16 omode, s16 ffmode)
Definition: libgs.c:29
GsGParam_t * GsGetGParam(void)
Definition: libgs.c:24
static GsGParam_t gp_15
Definition: libgs.c:22
#define CRTC_SETTINGS_DEFAULT1
Definition: libgs.h:1884
@ GS_MODE_NTSC
Definition: libgs.h:56
#define GS_GET_CSR_gs_rev_number
Definition: libgs.h:1347
#define gs_p_pmode
Definition: libgs.h:190
#define GS_FFMD_FRAME
Definition: libgs.h:43
#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_INTERLACED
Definition: libgs.h:38
#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
Definition: libgs.h:333
signed short s16
Definition: tamtypes.h:52
volatile u64 vu64
Definition: tamtypes.h:39
unsigned char u8
Definition: tamtypes.h:23
unsigned long u64
Definition: tamtypes.h:34