5. Emulation Functions

These S2DEX GBIs are functions for emulation in the CPU.

[UP]


5.1 guS2DEmuBgRect1Cyc


void guS2DEmuBgRect1Cyc(Gfx **gdl_p, uObjBg *bg);

Description:
Emulate the operation of gSPBgRect1Cyc GBI from the S2DEX microcode in the CPU by combining it with another GBI
Arguments: gdl_p Pointer to display list pointer
The value for *gdl_p is automatically added.
  bg Pointer to uObjBg structure

Calling gSPBgRect1Cyc(gdl ++, bg) can be replaced by guS2DEmuBgRect1Cyc(&gdl, bg). See the section on gSPBgRect1Cyc for an explanation of the argument bg.

In addition, in order to announce the setting of a scissoring box and the setting of texture filters to this routine, it is necessary to call the guS2DEmuSetScissor function described below prior to guS2DEmuBgRect1Cyc.

This function generates GBIs which can be processed not only by S2DEX, but also by F3DEX. Because of this, a scaled scrolling BG and a 3D model can both be processed by a single microcode, even when they are displayed together.

[UP]


5.2 guS2DEmuSetScissor


void guS2DEmuSetScissor(u32 ulx, u32 uly, u32 lrx, u32 lry, u8 bilerp);

Description:
Sets the scissoring parameters and texture filters referred to during processing of the function guS2DEmuBgRect1Cyc.
Arguments:
ulx
X coordinate at upper-left of scissor box (u10.0)
uly
Y coordinate at upper-left of scissor box (u10.0)
lrx
X coordinate at lower-right of scissor box (u10.0)
lry
Y coordinate at lower-right of scissor box (u10.0)
bilerp
If Bilerp interpolation processing is being done on an image, any value other than 0 is set, if PointSample is used, 0 is set.

Normally, the scissor box range set by g[s]DPSetScissor is conveyed to this function as an argument. In addition, the default values for ulx, uly, lrx, lry, and bilerp are 0, 0, 320, 240, and 0, respectively, setting to render by PointSample in a 320x240 pixel frame buffer.

This function need only be called once prior to calling guS2DEmuBgRect1Cyc. As long as there are no changes to the scissor box and the texture filter, this only needs to be called once when the game is initializing and there is no need to call it every time a frame is rendered.

[UP]