mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 13:09:44 +00:00
Decompile DRA RenderPrimitives (#1371)
Got this working with the aid of PSP! Scratches here: PS1: https://decomp.me/scratch/FDWxW PSP: https://decomp.me/scratch/SObUR These are identical aside from the versions defined at the top of the context, and everything else is done with `ifdef`. Several of the `ifdef` differences are in structs that are defined in `include/psxsdk/libgpu.h`, and since they're in the PSX SDK, I don't want to add those PSP differences into that file. I imagine at some point we'll have a PSP libgpu.h or something, but until then, this function will not actually match on PSP. But since PSP is not the focus of this decomp, I think that's okay. This is 99% similar to Xeeynamo's scratch, the main difference is the treatment of the lines that look like `setSemiTrans(&primbuf->g2, var_s0->drawMode & DRAW_TRANSP);`.
This commit is contained in:
parent
cae2cd1030
commit
2399ca62cb
@ -100,8 +100,15 @@ typedef struct Prim {
|
||||
#define COLOR_LEN ((COLOR_BPP) / 8)
|
||||
#define PALETTE_LEN ((COLORS_PER_PAL) * ((COLOR_BPP) / 8))
|
||||
#define COLOR16(r, g, b, a) (r) + ((g) << 5) + ((b) << 10) + ((a) << 15)
|
||||
// PS1 and PSP use different values for these two
|
||||
#ifndef VERSION_PSP
|
||||
#define OTSIZE 0x200
|
||||
#define MAXSPRT16 0x280
|
||||
#endif
|
||||
#ifdef VERSION_PSP
|
||||
#define OTSIZE 0x600
|
||||
#define MAXSPRT16 0x320
|
||||
#endif
|
||||
#define MAX_DRAW_MODES 0x400
|
||||
#define MAX_TILE_COUNT 0x100
|
||||
#define MAX_LINE_G2_COUNT 0x100
|
||||
|
315
src/dra/4A538.c
315
src/dra/4A538.c
@ -1768,21 +1768,6 @@ void FreePrimitives(s32 primitiveIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NON_MATCHING
|
||||
INCLUDE_ASM("dra/nonmatchings/4A538", RenderPrimitives);
|
||||
#else
|
||||
typedef struct {
|
||||
/* 0x1F800000 */ OT_TYPE* ot;
|
||||
/* 0x1F800004 */ POLY_GT4* gt4;
|
||||
/* 0x1F800008 */ POLY_G4* g4;
|
||||
/* 0x1F80000C */ POLY_GT3* gt3;
|
||||
/* 0x1F800010 */ LINE_G2* g2;
|
||||
/* 0x1F800014 */ TILE* tile;
|
||||
/* 0x1F800018 */ DR_MODE* dr;
|
||||
/* 0x1F80001C */ SPRT* sprt;
|
||||
/* 0x1F800020 */ DR_ENV* env;
|
||||
} PrimitivesRenderer;
|
||||
|
||||
typedef union {
|
||||
TILE tile;
|
||||
LINE_G2 g2;
|
||||
@ -1792,37 +1777,50 @@ typedef union {
|
||||
SPRT sprt;
|
||||
} PrimBuf;
|
||||
|
||||
void RenderPrimitives(void) {
|
||||
#ifdef VERSION_PC
|
||||
RECT _rect;
|
||||
RECT* rect = &_rect;
|
||||
PrimitivesRenderer _r;
|
||||
PrimitivesRenderer* r = &_r;
|
||||
PrimBuf _primbuf;
|
||||
PrimBuf* primbuf = &_primbuf;
|
||||
#else
|
||||
RECT* rect = (RECT*)0x1F800128;
|
||||
PrimitivesRenderer* r = (PrimitivesRenderer*)0x1F800000;
|
||||
PrimBuf* primbuf = (PrimBuf*)0x1F800024;
|
||||
typedef struct {
|
||||
u_long* ot;
|
||||
POLY_GT4* gt4;
|
||||
POLY_G4* g4;
|
||||
POLY_GT3* gt3;
|
||||
LINE_G2* g2;
|
||||
TILE* tile;
|
||||
DR_MODE* dr;
|
||||
SPRT* sprt;
|
||||
DR_ENV* env;
|
||||
} PrimitivesRenderer;
|
||||
|
||||
#ifndef VERSION_PSP
|
||||
#define OT_MULT 1
|
||||
#endif
|
||||
#ifdef VERSION_PSP
|
||||
#define OT_MULT 3
|
||||
#endif
|
||||
|
||||
DRAWENV sp18;
|
||||
s32 i;
|
||||
s16 sp80;
|
||||
Primitive* prim;
|
||||
DR_ENV* env;
|
||||
s32 useShadeTex;
|
||||
s32 var_a1;
|
||||
s32 tpage;
|
||||
s32 dtd;
|
||||
u16 var_v0;
|
||||
u16 drawMode;
|
||||
u8 primType;
|
||||
void RenderPrimitives(void) {
|
||||
#ifdef VERSION_PC
|
||||
u8 sp[SP_LEN];
|
||||
#endif
|
||||
#ifdef VERSION_PSP
|
||||
#define RECT_LOC 0x12C
|
||||
#endif
|
||||
#ifndef VERSION_PSP
|
||||
#define RECT_LOC 0x128
|
||||
#endif
|
||||
RECT* rect = (RECT*)SP(RECT_LOC);
|
||||
PrimitivesRenderer* r = (PrimitivesRenderer*)SP(0x000);
|
||||
PrimBuf* primbuf = (PrimBuf*)SP(0x024);
|
||||
|
||||
s32 i;
|
||||
Primitive* prim;
|
||||
u8 primType;
|
||||
bool useShadeTex;
|
||||
bool dtd;
|
||||
bool unkBool;
|
||||
|
||||
DRAWENV drawEnv;
|
||||
s16 drawOfs;
|
||||
DR_ENV* env;
|
||||
|
||||
rect->x = 0;
|
||||
rect->y = 0;
|
||||
rect->w = 255;
|
||||
rect->h = 255;
|
||||
r->ot = g_CurrentBuffer->ot;
|
||||
r->gt4 = &g_CurrentBuffer->polyGT4[g_GpuUsage.gt4];
|
||||
r->g4 = &g_CurrentBuffer->polyG4[g_GpuUsage.g4];
|
||||
@ -1832,6 +1830,10 @@ void RenderPrimitives(void) {
|
||||
r->dr = &g_CurrentBuffer->drawModes[g_GpuUsage.drawModes];
|
||||
r->sprt = &g_CurrentBuffer->sprite[g_GpuUsage.sp];
|
||||
r->env = &g_CurrentBuffer->env[g_GpuUsage.env];
|
||||
rect->x = 0;
|
||||
rect->y = 0;
|
||||
rect->w = 255;
|
||||
rect->h = 255;
|
||||
if (D_8003C0EC[3]) {
|
||||
if (g_GpuUsage.tile < MAX_TILE_COUNT) {
|
||||
setSemiTrans(r->tile, false);
|
||||
@ -1847,21 +1849,21 @@ void RenderPrimitives(void) {
|
||||
D_8003C0EC[3]--;
|
||||
}
|
||||
} else {
|
||||
var_a1 = 0;
|
||||
i = 0;
|
||||
prim = g_PrimBuf + i;
|
||||
for (; i < MAX_PRIM_COUNT; prim++, i++) {
|
||||
unkBool = 0;
|
||||
for (i = 0, prim = &g_PrimBuf[0]; i < MAX_PRIM_COUNT; prim++, i++) {
|
||||
primType = prim->type;
|
||||
if (!primType) {
|
||||
continue;
|
||||
}
|
||||
drawMode = prim->drawMode;
|
||||
if (drawMode & DRAW_HIDE) {
|
||||
if (prim->drawMode & DRAW_HIDE) {
|
||||
continue;
|
||||
}
|
||||
var_v0 = drawMode & DRAW_COLORS;
|
||||
useShadeTex = var_v0 < 1;
|
||||
if (D_800973EC != 0 && !(drawMode & DRAW_MENU)) {
|
||||
if (prim->drawMode & DRAW_COLORS) {
|
||||
useShadeTex = false;
|
||||
} else {
|
||||
useShadeTex = true;
|
||||
}
|
||||
if (D_800973EC != 0 && !(prim->drawMode & DRAW_MENU)) {
|
||||
continue;
|
||||
}
|
||||
if (prim->x0 < -512 || prim->x0 > 512) {
|
||||
@ -1870,25 +1872,28 @@ void RenderPrimitives(void) {
|
||||
if (prim->y0 < -512 || prim->y0 > 512) {
|
||||
continue;
|
||||
}
|
||||
if (drawMode & DRAW_UNK_400) {
|
||||
dtd = 1;
|
||||
if (var_a1 == 0) {
|
||||
if (prim->drawMode & DRAW_UNK_400) {
|
||||
dtd = true;
|
||||
if (!unkBool) {
|
||||
SetDrawMode(r->dr, 0, 0, 0, rect);
|
||||
addPrim(&r->ot[prim->priority], r->dr);
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->dr);
|
||||
r->dr++;
|
||||
g_GpuUsage.drawModes++;
|
||||
}
|
||||
} else {
|
||||
dtd = 0;
|
||||
dtd = false;
|
||||
}
|
||||
switch (primType) {
|
||||
case PRIM_TILE:
|
||||
case PRIM_TILE_ALT:
|
||||
setTile(&primbuf->tile);
|
||||
if (g_GpuUsage.tile < MAX_TILE_COUNT) {
|
||||
if (prim->drawMode & DRAW_TRANSP) {
|
||||
setSemiTrans(&primbuf->tile, true);
|
||||
}
|
||||
setSemiTrans(&primbuf->tile, prim->drawMode & DRAW_TRANSP);
|
||||
primbuf->tile.r0 = prim->r0;
|
||||
primbuf->tile.g0 = prim->g0;
|
||||
primbuf->tile.b0 = prim->b0;
|
||||
@ -1901,15 +1906,24 @@ void RenderPrimitives(void) {
|
||||
}
|
||||
primbuf->tile.w = prim->u0;
|
||||
primbuf->tile.h = prim->v0;
|
||||
__builtin_memcpy(r->tile, &primbuf->tile, sizeof(TILE));
|
||||
addPrim(&r->ot[prim->priority], r->tile);
|
||||
*r->tile = primbuf->tile;
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->tile);
|
||||
r->tile++;
|
||||
g_GpuUsage.tile++;
|
||||
if ((primType & 0x10) == 0 &&
|
||||
if (!(primType & 0x10) &&
|
||||
g_GpuUsage.drawModes < MAX_DRAW_MODES) {
|
||||
tpage = prim->drawMode & 0x60;
|
||||
SetDrawMode(r->dr, 0, dtd, tpage, rect);
|
||||
addPrim(&r->ot[prim->priority], r->dr);
|
||||
SetDrawMode(r->dr, 0, dtd, prim->drawMode & 0x60, rect);
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->dr);
|
||||
r->dr++;
|
||||
g_GpuUsage.drawModes++;
|
||||
}
|
||||
@ -1919,10 +1933,8 @@ void RenderPrimitives(void) {
|
||||
case 18:
|
||||
setLineG2(&primbuf->g2);
|
||||
if (g_GpuUsage.line < MAX_LINE_G2_COUNT) {
|
||||
if (prim->drawMode & DRAW_TRANSP) {
|
||||
setSemiTrans(&primbuf->g2, true);
|
||||
}
|
||||
setShadeTex(&primbuf->g2, !!useShadeTex);
|
||||
setSemiTrans(&primbuf->g2, prim->drawMode & DRAW_TRANSP);
|
||||
setShadeTex(&primbuf->g2, useShadeTex);
|
||||
primbuf->g2.r0 = prim->r0;
|
||||
primbuf->g2.g0 = prim->g0;
|
||||
primbuf->g2.b0 = prim->b0;
|
||||
@ -1940,15 +1952,24 @@ void RenderPrimitives(void) {
|
||||
primbuf->g2.x1 = prim->x1 + g_backbufferX;
|
||||
primbuf->g2.y1 = prim->y1 + g_backbufferY;
|
||||
}
|
||||
__builtin_memcpy(r->g2, &primbuf->g2, sizeof(LINE_G2));
|
||||
addPrim(&r->ot[prim->priority], r->g2);
|
||||
*r->g2 = primbuf->g2;
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->g2);
|
||||
r->g2++;
|
||||
g_GpuUsage.line++;
|
||||
if ((primType & 0x10) == 0 &&
|
||||
g_GpuUsage.drawModes < MAX_DRAW_MODES) {
|
||||
tpage = prim->drawMode & 0x60;
|
||||
SetDrawMode(r->dr, 0, dtd, tpage, rect);
|
||||
addPrim(&r->ot[prim->priority], r->dr);
|
||||
SetDrawMode(r->dr, 0, dtd, prim->drawMode & 0x60, rect);
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->dr);
|
||||
r->dr++;
|
||||
g_GpuUsage.drawModes++;
|
||||
}
|
||||
@ -1958,10 +1979,8 @@ void RenderPrimitives(void) {
|
||||
case 19:
|
||||
setPolyG4(&primbuf->g4);
|
||||
if (g_GpuUsage.g4 < MAX_POLY_G4_COUNT) {
|
||||
if (prim->drawMode & DRAW_TRANSP) {
|
||||
setSemiTrans(&primbuf->g4, true);
|
||||
}
|
||||
setShadeTex(&primbuf->g4, !!useShadeTex);
|
||||
setSemiTrans(&primbuf->g4, prim->drawMode & DRAW_TRANSP);
|
||||
setShadeTex(&primbuf->g4, useShadeTex);
|
||||
primbuf->g4.r0 = prim->r0;
|
||||
primbuf->g4.g0 = prim->g0;
|
||||
primbuf->g4.b0 = prim->b0;
|
||||
@ -1993,15 +2012,24 @@ void RenderPrimitives(void) {
|
||||
primbuf->g4.x3 = prim->x3 + g_backbufferX;
|
||||
primbuf->g4.y3 = prim->y3 + g_backbufferY;
|
||||
}
|
||||
__builtin_memcpy(r->g4, &primbuf->g4, sizeof(POLY_G4));
|
||||
addPrim(&r->ot[prim->priority], r->g4);
|
||||
*r->g4 = primbuf->g4;
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->g4);
|
||||
r->g4++;
|
||||
g_GpuUsage.g4++;
|
||||
if ((primType & 0x10) == 0 &&
|
||||
g_GpuUsage.drawModes < MAX_DRAW_MODES) {
|
||||
tpage = prim->drawMode & 0x60;
|
||||
SetDrawMode(r->dr, 0, dtd, tpage, rect);
|
||||
addPrim(&r->ot[prim->priority], r->dr);
|
||||
SetDrawMode(r->dr, 0, dtd, prim->drawMode & 0x60, rect);
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->dr);
|
||||
r->dr++;
|
||||
g_GpuUsage.drawModes++;
|
||||
}
|
||||
@ -2010,10 +2038,8 @@ void RenderPrimitives(void) {
|
||||
case PRIM_GT4:
|
||||
setPolyGT4(&primbuf->gt4);
|
||||
if (g_GpuUsage.gt4 < MAX_POLY_GT4_COUNT) {
|
||||
if (prim->drawMode & DRAW_TRANSP) {
|
||||
setSemiTrans(&primbuf->gt4, true);
|
||||
}
|
||||
setShadeTex(&primbuf->gt4, !!useShadeTex);
|
||||
setSemiTrans(&primbuf->gt4, prim->drawMode & DRAW_TRANSP);
|
||||
setShadeTex(&primbuf->gt4, useShadeTex);
|
||||
primbuf->gt4.r0 = prim->r0;
|
||||
primbuf->gt4.g0 = prim->g0;
|
||||
primbuf->gt4.b0 = prim->b0;
|
||||
@ -2055,14 +2081,23 @@ void RenderPrimitives(void) {
|
||||
primbuf->gt4.v3 = prim->v3;
|
||||
primbuf->gt4.tpage = prim->tpage + (prim->drawMode & 0x60);
|
||||
primbuf->gt4.clut = g_ClutIds[prim->clut];
|
||||
__builtin_memcpy(r->gt4, &primbuf->gt4, sizeof(POLY_GT4));
|
||||
addPrim(&r->ot[prim->priority], r->gt4);
|
||||
*r->gt4 = primbuf->gt4;
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->gt4);
|
||||
r->gt4++;
|
||||
g_GpuUsage.gt4++;
|
||||
if (dtd && g_GpuUsage.drawModes < MAX_DRAW_MODES) {
|
||||
tpage = 0;
|
||||
SetDrawMode(r->dr, 0, dtd, tpage, rect);
|
||||
addPrim(&r->ot[prim->priority], r->dr);
|
||||
SetDrawMode(r->dr, 0, dtd, 0, rect);
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->dr);
|
||||
r->dr++;
|
||||
g_GpuUsage.drawModes++;
|
||||
}
|
||||
@ -2071,10 +2106,8 @@ void RenderPrimitives(void) {
|
||||
case PRIM_GT3:
|
||||
setPolyGT3(&primbuf->gt3);
|
||||
if (g_GpuUsage.gt3 < MAX_POLY_GT3_COUNT) {
|
||||
if (prim->drawMode & DRAW_TRANSP) {
|
||||
setSemiTrans(&primbuf->gt3, true);
|
||||
}
|
||||
setShadeTex(&primbuf->gt3, !!useShadeTex);
|
||||
setSemiTrans(&primbuf->gt3, prim->drawMode & DRAW_TRANSP);
|
||||
setShadeTex(&primbuf->gt3, useShadeTex);
|
||||
primbuf->gt3.r0 = prim->r0;
|
||||
primbuf->gt3.g0 = prim->g0;
|
||||
primbuf->gt3.b0 = prim->b0;
|
||||
@ -2108,14 +2141,23 @@ void RenderPrimitives(void) {
|
||||
primbuf->gt3.tpage = prim->tpage + (prim->drawMode & 0x60);
|
||||
primbuf->gt3.clut = g_ClutIds[prim->clut];
|
||||
|
||||
__builtin_memcpy(r->gt3, &primbuf->gt3, sizeof(POLY_GT3));
|
||||
addPrim(&r->ot[prim->priority], r->gt3);
|
||||
*r->gt3 = primbuf->gt3;
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->gt3);
|
||||
r->gt3++;
|
||||
g_GpuUsage.gt3++;
|
||||
if (dtd && g_GpuUsage.drawModes < MAX_DRAW_MODES) {
|
||||
tpage = 0;
|
||||
SetDrawMode(r->dr, 0, dtd, tpage, rect);
|
||||
addPrim(&r->ot[prim->priority], r->dr);
|
||||
SetDrawMode(r->dr, 0, dtd, 0, rect);
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->dr);
|
||||
r->dr++;
|
||||
g_GpuUsage.drawModes++;
|
||||
}
|
||||
@ -2125,10 +2167,8 @@ void RenderPrimitives(void) {
|
||||
case 22:
|
||||
setSprt(&primbuf->sprt);
|
||||
if (g_GpuUsage.sp < MAX_SPRT_COUNT) {
|
||||
if (prim->drawMode & DRAW_TRANSP) {
|
||||
setSemiTrans(&primbuf->sprt, true);
|
||||
}
|
||||
setShadeTex(&primbuf->sprt, !!useShadeTex);
|
||||
setSemiTrans(&primbuf->sprt, prim->drawMode & DRAW_TRANSP);
|
||||
setShadeTex(&primbuf->sprt, useShadeTex);
|
||||
primbuf->sprt.r0 = prim->r0;
|
||||
primbuf->sprt.g0 = prim->g0;
|
||||
primbuf->sprt.b0 = prim->b0;
|
||||
@ -2144,15 +2184,26 @@ void RenderPrimitives(void) {
|
||||
primbuf->sprt.w = prim->u1;
|
||||
primbuf->sprt.h = prim->v1;
|
||||
primbuf->sprt.clut = g_ClutIds[prim->clut];
|
||||
__builtin_memcpy(r->sprt, &primbuf->sprt, sizeof(SPRT));
|
||||
addPrim(&r->ot[prim->priority], r->sprt);
|
||||
*r->sprt = primbuf->sprt;
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->sprt);
|
||||
r->sprt++;
|
||||
g_GpuUsage.sp++;
|
||||
if ((primType & 0x10) == 0 &&
|
||||
g_GpuUsage.drawModes < MAX_DRAW_MODES) {
|
||||
tpage = prim->tpage + (prim->drawMode & 0x60);
|
||||
SetDrawMode(r->dr, 0, dtd, tpage, rect);
|
||||
addPrim(&r->ot[prim->priority], r->dr);
|
||||
SetDrawMode(
|
||||
r->dr, 0, dtd,
|
||||
prim->tpage + (prim->drawMode & 0x60), rect);
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->dr);
|
||||
r->dr++;
|
||||
g_GpuUsage.drawModes++;
|
||||
}
|
||||
@ -2162,31 +2213,45 @@ void RenderPrimitives(void) {
|
||||
if (g_GpuUsage.env < MAX_ENV_COUNT) {
|
||||
env = *(DR_ENV**)&prim->r1;
|
||||
if (prim->drawMode & DRAW_UNK_1000) {
|
||||
sp80 = g_CurrentBuffer->draw.ofs[0];
|
||||
*(s16*)&env->code[2] = sp80;
|
||||
*(s16*)&env->code[7] = sp80;
|
||||
drawOfs = g_CurrentBuffer->draw.ofs[0];
|
||||
#ifndef VERSION_PSP
|
||||
*(s16*)&env->code[2] = drawOfs;
|
||||
*(s16*)&env->code[7] = drawOfs;
|
||||
#endif
|
||||
#ifdef VERSION_PSP
|
||||
*(s16*)&env->code[3] = drawOfs;
|
||||
*(s16*)&env->code[1] = drawOfs;
|
||||
#endif
|
||||
}
|
||||
if (prim->drawMode & DRAW_UNK_800) {
|
||||
__builtin_memcpy(
|
||||
&sp18, &g_CurrentBuffer->draw, sizeof(DRAWENV));
|
||||
sp18.isbg = 0;
|
||||
SetDrawEnv(env, &sp18);
|
||||
drawEnv = g_CurrentBuffer->draw;
|
||||
drawEnv.isbg = 0;
|
||||
SetDrawEnv(env, &drawEnv);
|
||||
}
|
||||
__builtin_memcpy(r->env, env, sizeof(DR_ENV));
|
||||
*r->env = *env;
|
||||
#ifndef VERSION_PSP
|
||||
if (prim->drawMode & DRAW_UNK_1000) {
|
||||
env = r->env;
|
||||
*(s16*)&env->code[0] += sp80;
|
||||
*(s16*)&env->code[1] += sp80;
|
||||
*(s16*)&env->code[0] += drawOfs;
|
||||
*(s16*)&env->code[1] += drawOfs;
|
||||
}
|
||||
addPrim(&r->ot[prim->priority], r->env);
|
||||
#endif
|
||||
#ifdef VERSION_PSP
|
||||
if (prim->priority < 0 || prim->priority >= 0x200) {
|
||||
prim->priority = 0x1FF;
|
||||
}
|
||||
#endif
|
||||
addPrim(&r->ot[prim->priority * OT_MULT], r->env);
|
||||
r->env++;
|
||||
g_GpuUsage.env++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
var_v0 = primType & 0x10;
|
||||
var_a1 = var_v0 != 0;
|
||||
if (primType & 0x10) {
|
||||
unkBool = true;
|
||||
} else {
|
||||
unkBool = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user