PS2SDK
PS2 Homebrew Libraries
screenshot.c File Reference
#include "screenshot.h"
#include <tamtypes.h>
#include <kernel.h>
#include <fcntl.h>
#include <unistd.h>
+ Include dependency graph for screenshot.c:

Go to the source code of this file.

Macros

#define PS2SS_GIF_AD   0x0e
 
#define PS2SS_GIFTAG(NLOOP, EOP, PRE, PRIM, FLG, NREG)
 
#define PS2SS_GSBITBLTBUF_SET(sbp, sbw, spsm, dbp, dbw, dpsm)
 
#define PS2SS_GSTRXREG_SET(rrw, rrh)   ((u64)(rrw) | ((u64)(rrh) << 32))
 
#define PS2SS_GSTRXPOS_SET(ssax, ssay, dsax, dsay, dir)
 
#define PS2SS_GSTRXDIR_SET(xdr)   ((u64)(xdr))
 
#define PS2SS_GSBITBLTBUF   0x50
 
#define PS2SS_GSFINISH   0x61
 
#define PS2SS_GSTRXPOS   0x51
 
#define PS2SS_GSTRXREG   0x52
 
#define PS2SS_GSTRXDIR   0x53
 
#define PS2SS_GSPSMCT32   0
 
#define PS2SS_GSPSMCT24   1
 
#define PS2SS_GSPSMCT16   2
 
#define PS2SS_D1_CHCR   ((volatile unsigned int *)(0x10009000))
 
#define PS2SS_D1_MADR   ((volatile unsigned int *)(0x10009010))
 
#define PS2SS_D1_QWC   ((volatile unsigned int *)(0x10009020))
 
#define PS2SS_D1_TADR   ((volatile unsigned int *)(0x10009030))
 
#define PS2SS_D1_ASR0   ((volatile unsigned int *)(0x10009040))
 
#define PS2SS_D1_ASR1   ((volatile unsigned int *)(0x10009050))
 
#define PS2SS_CSR_FINISH   (1 << 1)
 
#define PS2SS_GS_CSR   ((volatile u64 *)(0x12001000))
 
#define PS2SS_GS_BUSDIR   ((volatile u64 *)(0x12001040))
 
#define PS2SS_VIF1_STAT   ((volatile u32 *)(0x10003c00))
 
#define PS2SS_VIF1_STAT_FDR   (1<< 23)
 
#define PS2SS_VIF1_MSKPATH3(mask)   ((u32)(mask) | ((u32)0x06 << 24))
 
#define PS2SS_VIF1_NOP   0
 
#define PS2SS_VIF1_FLUSHA   (((u32)0x13 << 24))
 
#define PS2SS_VIF1_DIRECT(count)   ((u32)(count) | ((u32)(0x50) << 24))
 
#define PS2SS_VIF1_FIFO   ((volatile u128 *)(0x10005000))
 

Functions

void ps2_screenshot_16to32_buffer (void *pTemp, u32 w, u32 h)
 
void ps2_screenshot_16to32_line (void *pTemp, u32 w)
 
int ps2_screenshot_file (const char *pFilename, unsigned int VramAdress, unsigned int Width, unsigned int Height, unsigned int Psm)
 
int ps2_screenshot (void *pDest, unsigned int VramAdress, unsigned int x, unsigned int y, unsigned int Width, unsigned int Height, unsigned int Psm)
 

Detailed Description

Screenshot

Definition in file screenshot.c.

Macro Definition Documentation

◆ PS2SS_GIFTAG

#define PS2SS_GIFTAG (   NLOOP,
  EOP,
  PRE,
  PRIM,
  FLG,
  NREG 
)
Value:
((u64)(NLOOP) << 0) | \
((u64)(EOP) << 15) | \
((u64)(PRE) << 46) | \
((u64)(PRIM) << 47) | \
((u64)(FLG) << 58) | \
((u64)(NREG) << 60)

Definition at line 27 of file screenshot.c.

◆ PS2SS_GSBITBLTBUF_SET

#define PS2SS_GSBITBLTBUF_SET (   sbp,
  sbw,
  spsm,
  dbp,
  dbw,
  dpsm 
)
Value:
((u64)(sbp) | ((u64)(sbw) << 16) | \
((u64)(spsm) << 24) | ((u64)(dbp) << 32) | \
((u64)(dbw) << 48) | ((u64)(dpsm) << 56))

Definition at line 35 of file screenshot.c.

◆ PS2SS_GSTRXPOS_SET

#define PS2SS_GSTRXPOS_SET (   ssax,
  ssay,
  dsax,
  dsay,
  dir 
)
Value:
((u64)(ssax) | ((u64)(ssay) << 16) | \
((u64)(dsax) << 32) | ((u64)(dsay) << 48) | \
((u64)(dir) << 59))

Definition at line 43 of file screenshot.c.

Function Documentation

◆ ps2_screenshot_16to32_buffer()

void ps2_screenshot_16to32_buffer ( void *  pTemp,
u32  w,
u32  h 
)

Converts to a buffer that fits tga

Definition at line 308 of file screenshot.c.

◆ ps2_screenshot_16to32_line()

void ps2_screenshot_16to32_line ( void *  pTemp,
u32  w 
)

Converts to a buffer that fits tga

Definition at line 300 of file screenshot.c.

◆ ps2_screenshot()

int ps2_screenshot ( void *  pDest,
unsigned int  VramAdress,
unsigned int  x,
unsigned int  y,
unsigned int  Width,
unsigned int  Height,
unsigned int  Psm 
)

Downloads vram back to host

Parameters
pDestTemporary storeage for the screen (allocated by user)
VramAdresspointer to where in vram to transfer from (wordaddress/64)
WidthWidth of Screen
HeightWidth of Screen
PsmPixelformat of screen

Definition at line 181 of file screenshot.c.