PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
+ Collaboration diagram for Utils:

Macros

#define VU_GS_PRIM(PRIM, IIP, TME, FGE, ABE, AA1, FST, CTXT, FIX)   (u128)(((FIX << 10) | (CTXT << 9) | (FST << 8) | (AA1 << 7) | (ABE << 6) | (FGE << 5) | (TME << 4) | (IIP << 3) | (PRIM)))
 
#define VU_GS_GIFTAG(NLOOP, EOP, PRE, PRIM, FLG, NREG)   (((u64)(NREG) << 60) | ((u64)(FLG) << 58) | ((u64)(PRIM) << 47) | ((u64)(PRE) << 46) | (EOP << 15) | (NLOOP << 0))
 

Functions

static void packet2_utils_vu_add_double_buffer (packet2_t *packet2, u16 base, u16 offset)
 
static void packet2_utils_vu_add_unpack_data (packet2_t *packet2, u32 t_dest_address, void *t_data, u32 t_size, u8 t_use_top)
 
static void packet2_utils_vu_open_unpack (packet2_t *packet2, u32 t_dest_address, u8 t_use_top)
 
static u32 packet2_utils_vu_close_unpack (packet2_t *packet2)
 
static void packet2_utils_vu_add_continue_program (packet2_t *packet2)
 
static void packet2_utils_vu_add_start_program (packet2_t *packet2, u32 addr)
 
static void packet2_utils_vu_add_end_tag (packet2_t *packet2)
 
static u32 packet2_utils_get_packet_size_for_program (u32 *start, u32 *end)
 
static void packet2_utils_gif_add_set (packet2_t *packet2, u32 loops_count)
 
static void packet2_utils_gs_add_lod (packet2_t *packet2, lod_t *lod)
 
static void packet2_utils_gs_add_texbuff_clut (packet2_t *packet2, texbuffer_t *texbuff, clutbuffer_t *clut)
 
static void packet2_utils_gs_add_draw_finish_giftag (packet2_t *packet2)
 
static void packet2_utils_gs_add_prim_giftag (packet2_t *packet2, prim_t *prim, u32 loops_count, u32 nreg, u8 nreg_count, u8 context)
 

Detailed Description

Useful functions and examples for libpacket2.

Macro Definition Documentation

◆ VU_GS_PRIM

#define VU_GS_PRIM (   PRIM,
  IIP,
  TME,
  FGE,
  ABE,
  AA1,
  FST,
  CTXT,
  FIX 
)    (u128)(((FIX << 10) | (CTXT << 9) | (FST << 8) | (AA1 << 7) | (ABE << 6) | (FGE << 5) | (TME << 4) | (IIP << 3) | (PRIM)))

#include <ee/packet2/include/packet2_utils.h>

Definition at line 32 of file packet2_utils.h.

◆ VU_GS_GIFTAG

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

#include <ee/packet2/include/packet2_utils.h>

Definition at line 33 of file packet2_utils.h.

Function Documentation

◆ packet2_utils_vu_add_double_buffer()

static void packet2_utils_vu_add_double_buffer ( packet2_t packet2,
u16  base,
u16  offset 
)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Add VU buffers size settings.

Parameters
t_baseBase address (qw)
t_offsetOffset address (qw)

Definition at line 49 of file packet2_utils.h.

References packet2_chain_close_tag(), packet2_chain_open_cnt(), packet2_vif_base(), and packet2_vif_offset().

◆ packet2_utils_vu_add_unpack_data()

static void packet2_utils_vu_add_unpack_data ( packet2_t packet2,
u32  t_dest_address,
void *  t_data,
u32  t_size,
u8  t_use_top 
)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Add data via REF tag and UNPACK. Please be sure that data is aligned, and there is no any open UNPACK/DIRECT.

Parameters
packet2Pointer to packet2.
t_dest_addressDestination address.
t_dataData pointer.
t_sizeSize in quadwords.
t_use_topUnpack to current double buffer?

Definition at line 67 of file packet2_utils.h.

References packet2_chain_ref(), packet2_vif_close_unpack_manual(), packet2_vif_open_unpack(), and packet2_vif_stcycl().

◆ packet2_utils_vu_open_unpack()

static void packet2_utils_vu_open_unpack ( packet2_t packet2,
u32  t_dest_address,
u8  t_use_top 
)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Open CNT tag + VU unpack.

Parameters
packet2Pointer to packet2.
t_dest_addressDestination address.
t_use_topUnpack to current double buffer?

Definition at line 81 of file packet2_utils.h.

References packet2_chain_open_cnt(), packet2_vif_open_unpack(), and packet2_vif_stcycl().

◆ packet2_utils_vu_close_unpack()

static u32 packet2_utils_vu_close_unpack ( packet2_t packet2)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Close CNT tag + VU unpack.

Returns
Unpacked qwords count

Definition at line 92 of file packet2_utils.h.

References packet2_chain_close_tag(), packet2_vif_close_unpack_auto(), and packet2_vif_pad128().

◆ packet2_utils_vu_add_continue_program()

static void packet2_utils_vu_add_continue_program ( packet2_t packet2)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Continue VU micro program (from –cont line). Adds FLUSH and MSCNT VIF opcodes.

Definition at line 103 of file packet2_utils.h.

References packet2_chain_close_tag(), packet2_chain_open_cnt(), packet2_vif_flush(), and packet2_vif_mscnt().

◆ packet2_utils_vu_add_start_program()

static void packet2_utils_vu_add_start_program ( packet2_t packet2,
u32  addr 
)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Start VU micro program. Adds FLUSH and MSCAL VIF opcodes.

Definition at line 115 of file packet2_utils.h.

References packet2_chain_close_tag(), packet2_chain_open_cnt(), packet2_vif_flush(), and packet2_vif_mscal().

◆ packet2_utils_vu_add_end_tag()

static void packet2_utils_vu_add_end_tag ( packet2_t packet2)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Add aligned END tag (with nops).

Definition at line 124 of file packet2_utils.h.

References packet2_chain_close_tag(), packet2_chain_open_end(), and packet2_vif_nop().

◆ packet2_utils_get_packet_size_for_program()

static u32 packet2_utils_get_packet_size_for_program ( u32 *  start,
u32 *  end 
)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Get program size in qws

Parameters
startStart address.
endEnd address.
Returns
Packet size in qws for specified program (instructions/256 + 1qw for tolerance).

Definition at line 138 of file packet2_utils.h.

References count.

◆ packet2_utils_gif_add_set()

static void packet2_utils_gif_add_set ( packet2_t packet2,
u32  loops_count 
)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Add set GIFTag which will be sent from VU1 via XGKICK instruction.

Parameters
packet2Pointer to packet2.
loops_countHow many GIF tags there will be?

Definition at line 157 of file packet2_utils.h.

References GIF_FLG_PACKED, and GIF_REG_AD.

◆ packet2_utils_gs_add_lod()

static void packet2_utils_gs_add_lod ( packet2_t packet2,
lod_t lod 
)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Add lod GIFTag which will be sent from VU1 via XGKICK instruction.

Parameters
packet2Pointer to packet2.
lodPointer to lod settings.

Definition at line 172 of file packet2_utils.h.

References GS_REG_TEX1.

◆ packet2_utils_gs_add_texbuff_clut()

static void packet2_utils_gs_add_texbuff_clut ( packet2_t packet2,
texbuffer_t texbuff,
clutbuffer_t clut 
)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Add texture buffer / clut GIFTag which will be sent from VU1 via XGKICK instruction.

Parameters
packet2Pointer to packet2.
texbuffPointer to texture buffer.
clutPointer to clut buffer.

Definition at line 194 of file packet2_utils.h.

References GS_REG_TEX0.

◆ packet2_utils_gs_add_draw_finish_giftag()

static void packet2_utils_gs_add_draw_finish_giftag ( packet2_t packet2)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Add draw finish event GIFTag which will be sent from VU1 via XGKICK instruction. Used for synchronization via draw_wait_finish()

Parameters
packet2Pointer to packet2.

Definition at line 220 of file packet2_utils.h.

References GS_REG_FINISH.

◆ packet2_utils_gs_add_prim_giftag()

static void packet2_utils_gs_add_prim_giftag ( packet2_t packet2,
prim_t prim,
u32  loops_count,
u32  nreg,
u8  nreg_count,
u8  context 
)
inlinestatic

#include <ee/packet2/include/packet2_utils.h>

Add drawing (prim) GIFTag which will be sent from VU1 via XGKICK instruction.

Parameters
packet2Pointer to packet2.
primPointer to prim settings.
loops_countGIF tag loops count.
nregWhat types of data we will use?
nreg_countHow many types there are in nreg?
contextDrawing context

Definition at line 235 of file packet2_utils.h.