DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
mglib.hpp File Reference

Go to the source code of this file.

Classes

struct  MG_PICKZ
 

Functions

void MGSetBGColor (float *color)
 
void MGBeginDrawShadow (sceGsTex0 tex0)
 
void MGEndDrawShadow (unsigned char alpha)
 
void MGSetBGColor (float red, float green, float blue, float alpha)
 
int MGGetVSyncCount ()
 
void MGClearScreen (u_char r, u_char g, u_char b, u_char a)
 
void MGClearZBuffer (int mode)
 
sceVif1Packet * GetVif1Packet ()
 
void MGGetAmbient (float *ambient)
 
void MGSetAmbient (float *ambient)
 
void MGSetPLight (float(*direction)[4], float(*color)[4])
 
void MGGetPLight (float(*direction)[4], float(*color)[4])
 
int MGRotTransPers (int *screen, float *position, int fog)
 
int MGRotTransPers3DSprite (int *top_left, int *bottom_right, float *position, float width, float height, int fog)
 
void MGDraw (CFrame *frame)
 
void MGDrawShadowFast (CFrame *frame, float *position, float *normal)
 
void MGDrawShadowFast2 (CFrame *frame, float *position, float *normal)
 
void MGDrawShadow (CFrame *frame, float *position, float *normal)
 
void MGDrawShade (CFrame *frame)
 
void MGGetFBuffTex (sceGsTex0 *tex0)
 
void MGSetGsZBUF (sceGsZbuf *zbuf)
 
void MGSetGsTEST (sceGsTest *test)
 
void MGFillBox (const CRect_i_ &rect, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 
void MGSetFogParm (float near_z, float far_z, unsigned char r, unsigned char g, unsigned char b, float far_fog, float near_fog)
 
void MGSetGsALPHA (sceGsAlpha *alpha)
 
void MGMoveImage (sceGsTex0 *src, const CRect_i_ &rect, sceGsTex0 *dst, int dst_x, int dst_y, int direction)
 
void MGMoveFrameBuffImage (sceGsTex0 *dst, int x, int y, int direction)
 
void MGSetViewMatrix (float(*view)[4], float *position)
 
void MGInit ()
 
void MGInitVSyncCallBack (int(*callback)(int))
 
void MGInitVif1Packet (u_long128 *buffer0, u_long128 *buffer1)
 
void MGBeginFrame ()
 
void MGEndFrame ()
 
void MGFlipWaitVSync (int wait)
 
void MGSetRenderInfo (float scale, float near_z, float far_z)
 
void MGSetProjection (float scale)
 
float MGGetProjection ()
 
void MGSetWindowRect ()
 
void MGSetWindowRect (CRect_i_ rect)
 
void MGGetBGColor (float *color)
 
void MGScisioringForce (int force)
 
int MGRotTransPers2D (int *screen, float *position, int fog)
 
void LensFlare (CTexture *texture, float *position, unsigned char red, unsigned char green, unsigned char blue)
 
void MGCalcColor (float *color, float *normal)
 
int MGClipVertex (float *position)
 
int MGClipBox (class CBoxVu0 *box)
 
void MGSetGsTEXA (sceGsTexa *texa)
 
void MGGetFBuffBackTex (sceGsTex0 *tex0)
 
void MGStretchMoveImage (sceGsTex0 *src, const CRect_i_ &src_rect, sceGsTex0 *dst, const CRect_i_ &dst_rect)
 

Variables

sceGifTag GiftagAD
 
RenderInfo mgRenderInfo
 
int DBuffID
 
sceDmaChan * DmaCH1
 
sceDmaChan * DmaCH2
 
sceDmaChan * DmaCH8
 
sceVif1Packet * Vif1Packet
 
s32 VSyncField__2
 
sceGsTex1 mgTEX1Env
 
s32 mgClearBackFlag
 
MG_PICKZ mgPickZBuff [16]
 
sceGsDBuff mgDBuff
 
sceVu0FVECTOR mgBackColor
 
sceVu0FMATRIX mgZeroMatrix
 
CRect_i_ mgWindowRect
 
sceGsTexa mgTexa
 
sceGsZbuf mgZBuffer
 
sceGsAlpha mgAlpha
 
sceGsTest mgPixelTest
 
float mgUnitMatrix [4][4]
 

Detailed Description

Declares the graphics library that the game draws every model through.

Definition in file mglib.hpp.

Function Documentation

◆ MGSetBGColor() [1/2]

void MGSetBGColor ( float *  color)

Sets the colour the frame is cleared to, from four floats in memory.

Mangled name:
MGSetBGColor__FPf
Address:
0x12E210
Size:
0x30
Return type:
Not recovered.

Definition at line 890 of file mglib.cpp.

◆ MGBeginDrawShadow()

void MGBeginDrawShadow ( sceGsTex0  tex0)

Starts drawing the shadows, which go through a texture of their own.

Mangled name:
MGBeginDrawShadow__F9sceGsTex0
Address:
0x1308A0
Size:
0x288
Return type:
Not recovered.

Definition at line 1820 of file mglib.cpp.

◆ MGEndDrawShadow()

void MGEndDrawShadow ( unsigned char  alpha)

Finishes drawing the shadows and lays them over the frame.

Mangled name:
MGEndDrawShadow__FUc
Address:
0x130B30
Size:
0x3B8
Return type:
Not recovered.

Definition at line 1862 of file mglib.cpp.

◆ MGSetBGColor() [2/2]

void MGSetBGColor ( float  red,
float  green,
float  blue,
float  alpha 
)

Sets the colour the frame is cleared to.

Mangled name:
MGSetBGColor__Fffff
Address:
0x12E090
Size:
0x174
Return type:
Not recovered.

Definition at line 845 of file mglib.cpp.

◆ MGGetVSyncCount()

int MGGetVSyncCount ( )

Returns the number of vertical syncs observed since initialization.

Definition at line 120 of file mglib.cpp.

◆ MGClearScreen()

void MGClearScreen ( u_char  r,
u_char  g,
u_char  b,
u_char  a 
)

Definition at line 1638 of file mglib.cpp.

◆ MGClearZBuffer()

void MGClearZBuffer ( int  mode)

Definition at line 1592 of file mglib.cpp.

◆ GetVif1Packet()

sceVif1Packet * GetVif1Packet ( )

Definition at line 902 of file mglib.cpp.

◆ MGGetAmbient()

void MGGetAmbient ( float *  ambient)

Reads the colour that lights every face of a model.

Mangled name:
MGGetAmbient__FPf
Address:
0x12DD30
Size:
0x28

Definition at line 763 of file mglib.cpp.

◆ MGSetAmbient()

void MGSetAmbient ( float *  ambient)

Sets the colour that lights every face of a model.

Mangled name:
MGSetAmbient__FPf
Address:
0x12DD00
Size:
0x2C

Definition at line 759 of file mglib.cpp.

◆ MGSetPLight()

void MGSetPLight ( float(*)  direction[4],
float(*)  color[4] 
)

Sets the direction and the colour of each of the four point lights.

Mangled name:
MGSetPLight__FPA4_fPA4_f
Address:
0x12DC20
Size:
0x90
Return type:
Not recovered.

◆ MGGetPLight()

void MGGetPLight ( float(*)  direction[4],
float(*)  color[4] 
)

Reads the lighting direction and colour matrices.

Mangled name:
MGGetPLight__FPA4_fPA4_f
Address:
0x12DCB0
Size:
0x48

◆ MGRotTransPers()

int MGRotTransPers ( int *  screen,
float *  position,
int  fog 
)

Turns one world position into a screen position.

Mangled name:
MGRotTransPers__FPiPfi
Address:
0x12E290
Size:
0x250

Definition at line 911 of file mglib.cpp.

◆ MGRotTransPers3DSprite()

int MGRotTransPers3DSprite ( int *  top_left,
int *  bottom_right,
float *  position,
float  width,
float  height,
int  fog 
)

Turns one world position into the two screen corners of a sprite that faces the eye, and gives back 1 while the sprite is on the screen.

Mangled name:
MGRotTransPers3DSprite__FPiPiPfffi
Address:
0x12E740
Size:
0x250

◆ MGDraw()

void MGDraw ( CFrame *  frame)

Draws one model.

Mangled name:
MGDraw__FP6CFrame
Address:
0x12ED80
Size:
0x6C
Return type:
Not recovered.

Definition at line 1324 of file mglib.cpp.

◆ MGDrawShadowFast()

void MGDrawShadowFast ( CFrame *  frame,
float *  position,
float *  normal 
)

Drops the shadow of one model onto the ground, with fewer faces than MGDrawShadow uses.

Mangled name:
MGDrawShadowFast__FP6CFramePfPf
Address:
0x1303B0
Size:
0x120
Return type:
Not recovered.

Definition at line 1697 of file mglib.cpp.

◆ MGDrawShadowFast2()

void MGDrawShadowFast2 ( CFrame *  frame,
float *  position,
float *  normal 
)

Drops the shadow of one model onto the ground, with fewer faces than MGDrawShadow uses.

Mangled name:
MGDrawShadowFast2__FP6CFramePfPf
Address:
0x1304D0
Size:
0x120
Return type:
Not recovered.

Definition at line 1725 of file mglib.cpp.

◆ MGDrawShadow()

void MGDrawShadow ( CFrame *  frame,
float *  position,
float *  normal 
)

Drops the shadow of one model onto the ground.

Mangled name:
MGDrawShadow__FP6CFramePfPf
Address:
0x1305F0
Size:
0x170
Return type:
Not recovered.

Definition at line 1753 of file mglib.cpp.

◆ MGDrawShade()

void MGDrawShade ( CFrame *  frame)

Draws the shade that lies on one model.

Mangled name:
MGDrawShade__FP6CFrame
Address:
0x130760
Size:
0x138
Return type:
Not recovered.

Definition at line 1787 of file mglib.cpp.

◆ MGGetFBuffTex()

void MGGetFBuffTex ( sceGsTex0 *  tex0)

Names the texture that stands for the frame being drawn.

Mangled name:
MGGetFBuffTex__FP9sceGsTex0
Address:
0x12F130
Size:
0x70

Definition at line 1408 of file mglib.cpp.

◆ MGSetGsZBUF()

void MGSetGsZBUF ( sceGsZbuf *  zbuf)

Sets the register that names where the depth buffer lives.

Mangled name:
MGSetGsZBUF__FP9sceGsZbuf
Address:
0x12EEC0
Size:
0xC4
Return type:
Not recovered.

Definition at line 1351 of file mglib.cpp.

◆ MGSetGsTEST()

void MGSetGsTEST ( sceGsTest *  test)

Sets the register that names which pixels a primitive may write.

Mangled name:
MGSetGsTEST__FP9sceGsTest
Address:
0x12EDF0
Size:
0xC4
Return type:
Not recovered.

Definition at line 1333 of file mglib.cpp.

◆ MGFillBox()

void MGFillBox ( const CRect_i_ &  rect,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)

Fills a rectangle of the frame with one colour.

Mangled name:
MGFillBox__FRC8CRect_i_UcUcUcUc
Address:
0x12FA70
Size:
0x2C0

Definition at line 1557 of file mglib.cpp.

◆ MGSetFogParm()

void MGSetFogParm ( float  near_z,
float  far_z,
unsigned char  r,
unsigned char  g,
unsigned char  b,
float  far_fog,
float  near_fog 
)

Sets how far the fog reaches and what colour it is.

Mangled name:
MGSetFogParm__FffUcUcUcff
Address:
0x12E010
Size:
0x7C
Return type:
Not recovered.

Definition at line 833 of file mglib.cpp.

◆ MGSetGsALPHA()

void MGSetGsALPHA ( sceGsAlpha *  alpha)

Sets the register that names how a primitive blends with the frame.

Mangled name:
MGSetGsALPHA__FP10sceGsAlpha
Address:
0x12EF90
Size:
0xC4
Return type:
Not recovered.

Definition at line 1369 of file mglib.cpp.

◆ MGMoveImage()

void MGMoveImage ( sceGsTex0 *  src,
const CRect_i_ &  rect,
sceGsTex0 *  dst,
int  dst_x,
int  dst_y,
int  direction 
)

Copies a rectangle of one texture into another.

Mangled name:
MGMoveImage__FP9sceGsTex0RC8CRect_i_P9sceGsTex0iii
Address:
0x12F210
Size:
0x21C
Return type:
Not recovered.

Definition at line 1424 of file mglib.cpp.

◆ MGMoveFrameBuffImage()

void MGMoveFrameBuffImage ( sceGsTex0 *  dst,
int  x,
int  y,
int  direction 
)

Copies the frame being drawn into a texture.

Mangled name:
MGMoveFrameBuffImage__FP9sceGsTex0iii
Address:
0x12F970
Size:
0x100
Return type:
Not recovered.

Definition at line 1533 of file mglib.cpp.

◆ MGSetViewMatrix()

void MGSetViewMatrix ( float(*)  view[4],
float *  position 
)

Sets the matrix that puts the world in front of the eye, and where the eye stands.

Mangled name:
MGSetViewMatrix__FPA4_fPf
Address:
0x12DFA0
Size:
0x6C
Return type:
Not recovered.

◆ MGInit()

void MGInit ( )

Initializes the renderer, its GS state, and its shared vectors and matrices.

Mangled name:
MGInit__Fv
Address:
0x12C220
Size:
0x4E0

Definition at line 124 of file mglib.cpp.

◆ MGInitVSyncCallBack()

void MGInitVSyncCallBack ( int(*)(int)  callback)

Replaces the callback invoked from the vertical-sync interrupt handler.

Mangled name:
MGInitVSyncCallBack__FPFi_i
Address:
0x12C700
Size:
0x18

Definition at line 235 of file mglib.cpp.

◆ MGInitVif1Packet()

void MGInitVif1Packet ( u_long128 *  buffer0,
u_long128 *  buffer1 
)

Initializes the two alternating VIF1 packet builders over caller buffers.

Mangled name:
MGInitVif1Packet__FP1P1
Address:
0x12C720
Size:
0xE0

Definition at line 245 of file mglib.cpp.

◆ MGBeginFrame()

void MGBeginFrame ( )

Opens packet construction for a new rendered frame.

Mangled name:
MGBeginFrame__Fv
Address:
0x12CD90
Size:
0x2E0

Definition at line 387 of file mglib.cpp.

◆ MGEndFrame()

void MGEndFrame ( )

Submits the current packet, completes frame processing, and swaps buffers.

Mangled name:
MGEndFrame__Fv
Address:
0x12D100
Size:
0x5CC

Definition at line 469 of file mglib.cpp.

◆ MGFlipWaitVSync()

void MGFlipWaitVSync ( int  wait)

Selects how many vertical syncs frame completion waits for.

Mangled name:
MGFlipWaitVSync__Fi
Address:
0x12D6D0
Size:
0xC

Definition at line 594 of file mglib.cpp.

◆ MGSetRenderInfo()

void MGSetRenderInfo ( float  scale,
float  near_z,
float  far_z 
)

Rebuilds the projection and clip-volume values used for rendering.

Mangled name:
MGSetRenderInfo__Ffff
Address:
0x12D6E0
Size:
0x27C

Definition at line 625 of file mglib.cpp.

◆ MGSetProjection()

void MGSetProjection ( float  scale)

Updates the projection scale and its dependent rendering values.

Mangled name:
MGSetProjection__Ff
Address:
0x12D960
Size:
0x30

Definition at line 687 of file mglib.cpp.

◆ MGGetProjection()

float MGGetProjection ( )

Returns the current projection scale.

Mangled name:
MGGetProjection__Fv
Address:
0x12D990
Size:
0x10

Definition at line 691 of file mglib.cpp.

◆ MGSetWindowRect() [1/2]

void MGSetWindowRect ( )

Restores the default full-frame scissor rectangle.

Mangled name:
MGSetWindowRect__Fv
Address:
0x12D9A0
Size:
0x13C

Definition at line 698 of file mglib.cpp.

◆ MGSetWindowRect() [2/2]

void MGSetWindowRect ( CRect_i_  rect)

Sets the scissor rectangle used for subsequent drawing.

Mangled name:
MGSetWindowRect__F8CRect_i_
Address:
0x12DAE0
Size:
0x13C

Definition at line 721 of file mglib.cpp.

◆ MGGetBGColor()

void MGGetBGColor ( float *  color)

Returns the background clear colour.

Mangled name:
MGGetBGColor__FPf
Address:
0x12E240
Size:
0x28

Definition at line 894 of file mglib.cpp.

◆ MGScisioringForce()

void MGScisioringForce ( int  force)

Forces or releases render-info scissoring.

Mangled name:
MGScisioringForce__Fi
Address:
0x12E270
Size:
0x10

Definition at line 898 of file mglib.cpp.

◆ MGRotTransPers2D()

int MGRotTransPers2D ( int *  screen,
float *  position,
int  fog 
)

Projects a world position into unscaled two-dimensional screen coordinates.

Mangled name:
MGRotTransPers2D__FPiPfi
Address:
0x12E4E0
Size:
0x260

Definition at line 962 of file mglib.cpp.

◆ LensFlare()

void LensFlare ( CTexture *  texture,
float *  position,
unsigned char  red,
unsigned char  green,
unsigned char  blue 
)

Draws the screen-space flare produced by a visible world-space light source.

Mangled name:
LensFlare__FP8CTexturePfUcUcUc
Address:
0x158EB0
Size:
0x2E4

Definition at line 203 of file snd.cpp.

◆ MGCalcColor()

void MGCalcColor ( float *  color,
float *  normal 
)

Calculates a lit vertex colour from a surface normal.

Mangled name:
MGCalcColor__FPfPf
Address:
0x12E990
Size:
0xA8

◆ MGClipVertex()

int MGClipVertex ( float *  position)

Returns the clip-plane mask for a world-space vertex.

Mangled name:
MGClipVertex__FPf
Address:
0x12EA40
Size:
0x23C

Definition at line 1216 of file mglib.cpp.

◆ MGClipBox()

int MGClipBox ( class CBoxVu0 *  box)

Rejects a box when all of its corners lie beyond one clip plane.

Mangled name:
MGClipBox__FP7CBoxVu0
Address:
0x12EC80
Size:
0xF4

Definition at line 1290 of file mglib.cpp.

◆ MGSetGsTEXA()

void MGSetGsTEXA ( sceGsTexa *  texa)

Sets the register that controls texture alpha expansion.

Mangled name:
MGSetGsTEXA__FP9sceGsTexa
Address:
0x12F060
Size:
0xC4

Definition at line 1387 of file mglib.cpp.

◆ MGGetFBuffBackTex()

void MGGetFBuffBackTex ( sceGsTex0 *  tex0)

Names the frame buffer not currently being drawn as a texture.

Mangled name:
MGGetFBuffBackTex__FP9sceGsTex0
Address:
0x12F1A0
Size:
0x70

Definition at line 1414 of file mglib.cpp.

◆ MGStretchMoveImage()

void MGStretchMoveImage ( sceGsTex0 *  src,
const CRect_i_ &  src_rect,
sceGsTex0 *  dst,
const CRect_i_ &  dst_rect 
)

Draws a source texture rectangle into a differently sized destination rectangle.

Mangled name:
MGStretchMoveImage__FP9sceGsTex0RC8CRect_i_P9sceGsTex0RC8CRect_i_
Address:
0x12F430
Size:
0x538

Definition at line 1453 of file mglib.cpp.

Variable Documentation

◆ GiftagAD

sceGifTag GiftagAD
extern

Definition at line 53 of file mglib.cpp.

◆ mgRenderInfo

RenderInfo mgRenderInfo

What the renderer draws the current frame with.

Address:
0x1C75520
Size:
0x350

Definition at line 36 of file mglib.hpp.

◆ DBuffID

int DBuffID
extern

Index of the display buffer, and of each visual's built block, in use this frame.

Definition at line 26 of file mglib.cpp.

◆ DmaCH1

sceDmaChan* DmaCH1
extern

Definition at line 28 of file mglib.cpp.

◆ DmaCH2

sceDmaChan* DmaCH2
extern

Definition at line 29 of file mglib.cpp.

◆ DmaCH8

sceDmaChan* DmaCH8
extern

Definition at line 30 of file mglib.cpp.

◆ Vif1Packet

sceVif1Packet* Vif1Packet
extern

Definition at line 31 of file mglib.cpp.

◆ VSyncField__2

s32 VSyncField__2
extern

Definition at line 32 of file mglib.cpp.

◆ mgTEX1Env

sceGsTex1 mgTEX1Env
extern

Definition at line 40 of file mglib.cpp.

◆ mgClearBackFlag

s32 mgClearBackFlag
extern

Definition at line 33 of file mglib.cpp.

◆ mgPickZBuff

MG_PICKZ mgPickZBuff[16]
extern

Definition at line 52 of file mglib.cpp.

◆ mgDBuff

sceGsDBuff mgDBuff
extern

Definition at line 54 of file mglib.cpp.

◆ mgBackColor

sceVu0FVECTOR mgBackColor
extern

Definition at line 55 of file mglib.cpp.

◆ mgZeroMatrix

sceVu0FMATRIX mgZeroMatrix
extern

All-zero matrix; passed as both point-light matrices it turns the lights off.

Definition at line 87 of file mglib.cpp.

◆ mgTexa

sceGsTexa mgTexa
extern

Definition at line 44 of file mglib.cpp.

◆ mgZBuffer

sceGsZbuf mgZBuffer
extern

Register state used when configuring the depth buffer.

Definition at line 42 of file mglib.cpp.

◆ mgAlpha

sceGsAlpha mgAlpha
extern

Register state used when configuring primitive blending.

Definition at line 43 of file mglib.cpp.

◆ mgPixelTest

sceGsTest mgPixelTest
extern

Register state used when configuring pixel tests.

Definition at line 41 of file mglib.cpp.

◆ mgUnitMatrix

float mgUnitMatrix[4][4]
extern

Identity matrix shared by rendering helpers.

Definition at line 86 of file mglib.cpp.