PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
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)
 
#define PS2SS_GSTRXPOS_SET(ssax, ssay, dsax, dsay, dir)
 
#define PS2SS_GSTRXDIR_SET(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)
 
#define PS2SS_VIF1_NOP   0
 
#define PS2SS_VIF1_FLUSHA   (((u32)0x13 << 24))
 
#define PS2SS_VIF1_DIRECT(count)
 
#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_GIF_AD

#define PS2SS_GIF_AD   0x0e

Definition at line 25 of file screenshot.c.

◆ 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_GSTRXREG_SET

#define PS2SS_GSTRXREG_SET ( rrw,
rrh )
Value:
((u64)(rrw) | ((u64)(rrh) << 32))

Definition at line 40 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.

◆ PS2SS_GSTRXDIR_SET

#define PS2SS_GSTRXDIR_SET ( xdr)
Value:
((u64)(xdr))

Definition at line 48 of file screenshot.c.

◆ PS2SS_GSBITBLTBUF

#define PS2SS_GSBITBLTBUF   0x50

Definition at line 50 of file screenshot.c.

◆ PS2SS_GSFINISH

#define PS2SS_GSFINISH   0x61

Definition at line 51 of file screenshot.c.

◆ PS2SS_GSTRXPOS

#define PS2SS_GSTRXPOS   0x51

Definition at line 52 of file screenshot.c.

◆ PS2SS_GSTRXREG

#define PS2SS_GSTRXREG   0x52

Definition at line 53 of file screenshot.c.

◆ PS2SS_GSTRXDIR

#define PS2SS_GSTRXDIR   0x53

Definition at line 54 of file screenshot.c.

◆ PS2SS_GSPSMCT32

#define PS2SS_GSPSMCT32   0

Definition at line 56 of file screenshot.c.

◆ PS2SS_GSPSMCT24

#define PS2SS_GSPSMCT24   1

Definition at line 57 of file screenshot.c.

◆ PS2SS_GSPSMCT16

#define PS2SS_GSPSMCT16   2

Definition at line 58 of file screenshot.c.

◆ PS2SS_D1_CHCR

#define PS2SS_D1_CHCR   ((volatile unsigned int *)(0x10009000))

Definition at line 60 of file screenshot.c.

◆ PS2SS_D1_MADR

#define PS2SS_D1_MADR   ((volatile unsigned int *)(0x10009010))

Definition at line 61 of file screenshot.c.

◆ PS2SS_D1_QWC

#define PS2SS_D1_QWC   ((volatile unsigned int *)(0x10009020))

Definition at line 62 of file screenshot.c.

◆ PS2SS_D1_TADR

#define PS2SS_D1_TADR   ((volatile unsigned int *)(0x10009030))

Definition at line 63 of file screenshot.c.

◆ PS2SS_D1_ASR0

#define PS2SS_D1_ASR0   ((volatile unsigned int *)(0x10009040))

Definition at line 64 of file screenshot.c.

◆ PS2SS_D1_ASR1

#define PS2SS_D1_ASR1   ((volatile unsigned int *)(0x10009050))

Definition at line 65 of file screenshot.c.

◆ PS2SS_CSR_FINISH

#define PS2SS_CSR_FINISH   (1 << 1)

Definition at line 67 of file screenshot.c.

◆ PS2SS_GS_CSR

#define PS2SS_GS_CSR   ((volatile u64 *)(0x12001000))

Definition at line 68 of file screenshot.c.

◆ PS2SS_GS_BUSDIR

#define PS2SS_GS_BUSDIR   ((volatile u64 *)(0x12001040))

Definition at line 69 of file screenshot.c.

◆ PS2SS_VIF1_STAT

#define PS2SS_VIF1_STAT   ((volatile u32 *)(0x10003c00))

Definition at line 71 of file screenshot.c.

◆ PS2SS_VIF1_STAT_FDR

#define PS2SS_VIF1_STAT_FDR   (1<< 23)

Definition at line 72 of file screenshot.c.

◆ PS2SS_VIF1_MSKPATH3

#define PS2SS_VIF1_MSKPATH3 ( mask)
Value:
((u32)(mask) | ((u32)0x06 << 24))

Definition at line 73 of file screenshot.c.

◆ PS2SS_VIF1_NOP

#define PS2SS_VIF1_NOP   0

Definition at line 74 of file screenshot.c.

◆ PS2SS_VIF1_FLUSHA

#define PS2SS_VIF1_FLUSHA   (((u32)0x13 << 24))

Definition at line 75 of file screenshot.c.

◆ PS2SS_VIF1_DIRECT

#define PS2SS_VIF1_DIRECT ( count)
Value:
((u32)(count) | ((u32)(0x50) << 24))
u32 count
start sector of fragmented bd/file

Definition at line 76 of file screenshot.c.

◆ PS2SS_VIF1_FIFO

#define PS2SS_VIF1_FIFO   ((volatile u128 *)(0x10005000))

Definition at line 77 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_file()

int ps2_screenshot_file ( const char * pFilename,
unsigned int VramAdress,
unsigned int Width,
unsigned int Height,
unsigned int Psm )

Definition at line 84 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.