mirror of
https://gitlab.com/ryandwyer/perfect-dark.git
synced 2024-11-26 22:40:55 +00:00
Match menugfx_render_gradient
This commit is contained in:
parent
4e1d17764a
commit
3ff0d78f54
@ -550,196 +550,13 @@ Gfx *menugfx_draw_list_group_header(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s3
|
||||
return gdl;
|
||||
}
|
||||
|
||||
#if MATCHING
|
||||
GLOBAL_ASM(
|
||||
glabel menugfx_render_gradient
|
||||
/* f0e1ce8: 27bdffa0 */ addiu $sp,$sp,-96
|
||||
/* f0e1cec: afbf002c */ sw $ra,0x2c($sp)
|
||||
/* f0e1cf0: afa40060 */ sw $a0,0x60($sp)
|
||||
/* f0e1cf4: afb10028 */ sw $s1,0x28($sp)
|
||||
/* f0e1cf8: afb00024 */ sw $s0,0x24($sp)
|
||||
/* f0e1cfc: afa50064 */ sw $a1,0x64($sp)
|
||||
/* f0e1d00: afa60068 */ sw $a2,0x68($sp)
|
||||
/* f0e1d04: afa7006c */ sw $a3,0x6c($sp)
|
||||
/* f0e1d08: 0fc59e73 */ jal gfx_allocate_colours
|
||||
/* f0e1d0c: 24040003 */ addiu $a0,$zero,0x3
|
||||
/* f0e1d10: 00408825 */ or $s1,$v0,$zero
|
||||
/* f0e1d14: 0fc59e59 */ jal gfx_allocate_vertices
|
||||
/* f0e1d18: 24040006 */ addiu $a0,$zero,0x6
|
||||
/* f0e1d1c: 8fae0060 */ lw $t6,0x60($sp)
|
||||
/* f0e1d20: 3c18e700 */ lui $t8,0xe700
|
||||
/* f0e1d24: 00408025 */ or $s0,$v0,$zero
|
||||
/* f0e1d28: 25cf0008 */ addiu $t7,$t6,0x8
|
||||
/* f0e1d2c: afaf0060 */ sw $t7,0x60($sp)
|
||||
/* f0e1d30: adc00004 */ sw $zero,0x4($t6)
|
||||
/* f0e1d34: add80000 */ sw $t8,0x0($t6)
|
||||
/* f0e1d38: 8fb90060 */ lw $t9,0x60($sp)
|
||||
/* f0e1d3c: 3c0eba00 */ lui $t6,0xba00
|
||||
/* f0e1d40: 35ce1402 */ ori $t6,$t6,0x1402
|
||||
/* f0e1d44: 272d0008 */ addiu $t5,$t9,0x8
|
||||
/* f0e1d48: afad0060 */ sw $t5,0x60($sp)
|
||||
/* f0e1d4c: af200004 */ sw $zero,0x4($t9)
|
||||
/* f0e1d50: af2e0000 */ sw $t6,0x0($t9)
|
||||
/* f0e1d54: 8faf0060 */ lw $t7,0x60($sp)
|
||||
/* f0e1d58: 3c19b900 */ lui $t9,0xb900
|
||||
/* f0e1d5c: 37390002 */ ori $t9,$t9,0x2
|
||||
/* f0e1d60: 25f80008 */ addiu $t8,$t7,0x8
|
||||
/* f0e1d64: afb80060 */ sw $t8,0x60($sp)
|
||||
/* f0e1d68: ade00004 */ sw $zero,0x4($t7)
|
||||
/* f0e1d6c: adf90000 */ sw $t9,0x0($t7)
|
||||
/* f0e1d70: 8fad0060 */ lw $t5,0x60($sp)
|
||||
/* f0e1d74: 3c0ffc12 */ lui $t7,0xfc12
|
||||
/* f0e1d78: 35ef7e24 */ ori $t7,$t7,0x7e24
|
||||
/* f0e1d7c: 25ae0008 */ addiu $t6,$t5,0x8
|
||||
/* f0e1d80: afae0060 */ sw $t6,0x60($sp)
|
||||
/* f0e1d84: 2418f9fc */ addiu $t8,$zero,-1540
|
||||
/* f0e1d88: adb80004 */ sw $t8,0x4($t5)
|
||||
/* f0e1d8c: adaf0000 */ sw $t7,0x0($t5)
|
||||
/* f0e1d90: 8fb90060 */ lw $t9,0x60($sp)
|
||||
/* f0e1d94: 240f3000 */ addiu $t7,$zero,0x3000
|
||||
/* f0e1d98: 3c0eb600 */ lui $t6,0xb600
|
||||
/* f0e1d9c: 272d0008 */ addiu $t5,$t9,0x8
|
||||
/* f0e1da0: afad0060 */ sw $t5,0x60($sp)
|
||||
/* f0e1da4: af2f0004 */ sw $t7,0x4($t9)
|
||||
/* f0e1da8: af2e0000 */ sw $t6,0x0($t9)
|
||||
/* f0e1dac: 8fb80060 */ lw $t8,0x60($sp)
|
||||
/* f0e1db0: 3c0dba00 */ lui $t5,0xba00
|
||||
/* f0e1db4: 35ad0c02 */ ori $t5,$t5,0xc02
|
||||
/* f0e1db8: 27190008 */ addiu $t9,$t8,0x8
|
||||
/* f0e1dbc: afb90060 */ sw $t9,0x60($sp)
|
||||
/* f0e1dc0: 240e2000 */ addiu $t6,$zero,0x2000
|
||||
/* f0e1dc4: af0e0004 */ sw $t6,0x4($t8)
|
||||
/* f0e1dc8: af0d0000 */ sw $t5,0x0($t8)
|
||||
/* f0e1dcc: 24180001 */ addiu $t8,$zero,0x1
|
||||
/* f0e1dd0: 240f0002 */ addiu $t7,$zero,0x2
|
||||
/* f0e1dd4: afaf0010 */ sw $t7,0x10($sp)
|
||||
/* f0e1dd8: afb80014 */ sw $t8,0x14($sp)
|
||||
/* f0e1ddc: afa00018 */ sw $zero,0x18($sp)
|
||||
/* f0e1de0: 27a40060 */ addiu $a0,$sp,0x60
|
||||
/* f0e1de4: 00002825 */ or $a1,$zero,$zero
|
||||
/* f0e1de8: 24060002 */ addiu $a2,$zero,0x2
|
||||
/* f0e1dec: 0fc2ce70 */ jal tex_select
|
||||
/* f0e1df0: 00003825 */ or $a3,$zero,$zero
|
||||
/* f0e1df4: 8fb90060 */ lw $t9,0x60($sp)
|
||||
/* f0e1df8: 8fab0070 */ lw $t3,0x70($sp)
|
||||
/* f0e1dfc: 8fac0068 */ lw $t4,0x68($sp)
|
||||
/* f0e1e00: 8fa9006c */ lw $t1,0x6c($sp)
|
||||
/* f0e1e04: 8faa0064 */ lw $t2,0x64($sp)
|
||||
/* f0e1e08: 272d0008 */ addiu $t5,$t9,0x8
|
||||
/* f0e1e0c: afad0060 */ sw $t5,0x60($sp)
|
||||
/* f0e1e10: 3c0eb900 */ lui $t6,0xb900
|
||||
/* f0e1e14: 3c0f0050 */ lui $t7,0x50
|
||||
/* f0e1e18: 018b4021 */ addu $t0,$t4,$t3
|
||||
/* f0e1e1c: 35ef4240 */ ori $t7,$t7,0x4240
|
||||
/* f0e1e20: 35ce031d */ ori $t6,$t6,0x31d
|
||||
/* f0e1e24: af2e0000 */ sw $t6,0x0($t9)
|
||||
/* f0e1e28: af2f0004 */ sw $t7,0x4($t9)
|
||||
/* f0e1e2c: 03201025 */ or $v0,$t9,$zero
|
||||
/* f0e1e30: 05010003 */ bgez $t0,.L0f0e1e40
|
||||
/* f0e1e34: 0008c043 */ sra $t8,$t0,0x1
|
||||
/* f0e1e38: 25010001 */ addiu $at,$t0,0x1
|
||||
/* f0e1e3c: 0001c043 */ sra $t8,$at,0x1
|
||||
.L0f0e1e40:
|
||||
/* f0e1e40: 0018c840 */ sll $t9,$t8,0x1
|
||||
/* f0e1e44: 012a2023 */ subu $a0,$t1,$t2
|
||||
/* f0e1e48: 0099082a */ slt $at,$a0,$t9
|
||||
/* f0e1e4c: 10200001 */ beqz $at,.L0f0e1e54
|
||||
/* f0e1e50: 03004025 */ or $t0,$t8,$zero
|
||||
.L0f0e1e54:
|
||||
/* f0e1e54: 2406000a */ addiu $a2,$zero,0xa
|
||||
/* f0e1e58: 01460019 */ multu $t2,$a2
|
||||
/* f0e1e5c: 2407fff6 */ addiu $a3,$zero,-10
|
||||
/* f0e1e60: a6070004 */ sh $a3,0x4($s0)
|
||||
/* f0e1e64: a6070010 */ sh $a3,0x10($s0)
|
||||
/* f0e1e68: a607001c */ sh $a3,0x1c($s0)
|
||||
/* f0e1e6c: a6070028 */ sh $a3,0x28($s0)
|
||||
/* f0e1e70: a6070034 */ sh $a3,0x34($s0)
|
||||
/* f0e1e74: a6070040 */ sh $a3,0x40($s0)
|
||||
/* f0e1e78: a2000007 */ sb $zero,0x7($s0)
|
||||
/* f0e1e7c: a2000013 */ sb $zero,0x13($s0)
|
||||
/* f0e1e80: 00001012 */ mflo $v0
|
||||
/* f0e1e84: a6020000 */ sh $v0,0x0($s0)
|
||||
/* f0e1e88: a6020024 */ sh $v0,0x24($s0)
|
||||
/* f0e1e8c: 01860019 */ multu $t4,$a2
|
||||
/* f0e1e90: 00001812 */ mflo $v1
|
||||
/* f0e1e94: a6030002 */ sh $v1,0x2($s0)
|
||||
/* f0e1e98: a603000e */ sh $v1,0xe($s0)
|
||||
/* f0e1e9c: 01260019 */ multu $t1,$a2
|
||||
/* f0e1ea0: 24030004 */ addiu $v1,$zero,0x4
|
||||
/* f0e1ea4: a203001f */ sb $v1,0x1f($s0)
|
||||
/* f0e1ea8: a203002b */ sb $v1,0x2b($s0)
|
||||
/* f0e1eac: 00002012 */ mflo $a0
|
||||
/* f0e1eb0: a604000c */ sh $a0,0xc($s0)
|
||||
/* f0e1eb4: a6040018 */ sh $a0,0x18($s0)
|
||||
/* f0e1eb8: 01660019 */ multu $t3,$a2
|
||||
/* f0e1ebc: 24040008 */ addiu $a0,$zero,0x8
|
||||
/* f0e1ec0: a2040037 */ sb $a0,0x37($s0)
|
||||
/* f0e1ec4: a2040043 */ sb $a0,0x43($s0)
|
||||
/* f0e1ec8: 02202025 */ or $a0,$s1,$zero
|
||||
/* f0e1ecc: 00002812 */ mflo $a1
|
||||
/* f0e1ed0: a605001a */ sh $a1,0x1a($s0)
|
||||
/* f0e1ed4: a6050026 */ sh $a1,0x26($s0)
|
||||
/* f0e1ed8: 01460019 */ multu $t2,$a2
|
||||
/* f0e1edc: 00006812 */ mflo $t5
|
||||
/* f0e1ee0: a60d0030 */ sh $t5,0x30($s0)
|
||||
/* f0e1ee4: 00000000 */ nop
|
||||
/* f0e1ee8: 01060019 */ multu $t0,$a2
|
||||
/* f0e1eec: 00001012 */ mflo $v0
|
||||
/* f0e1ef0: a6020032 */ sh $v0,0x32($s0)
|
||||
/* f0e1ef4: a602003e */ sh $v0,0x3e($s0)
|
||||
/* f0e1ef8: 01260019 */ multu $t1,$a2
|
||||
/* f0e1efc: 00007012 */ mflo $t6
|
||||
/* f0e1f00: a60e003c */ sh $t6,0x3c($s0)
|
||||
/* f0e1f04: 8faf0074 */ lw $t7,0x74($sp)
|
||||
/* f0e1f08: ae2f0000 */ sw $t7,0x0($s1)
|
||||
/* f0e1f0c: 8fb80078 */ lw $t8,0x78($sp)
|
||||
/* f0e1f10: 3c0f0708 */ lui $t7,0x708
|
||||
/* f0e1f14: 35ef000c */ ori $t7,$t7,0xc
|
||||
/* f0e1f18: ae380008 */ sw $t8,0x8($s1)
|
||||
/* f0e1f1c: 8fb9007c */ lw $t9,0x7c($sp)
|
||||
/* f0e1f20: ae390004 */ sw $t9,0x4($s1)
|
||||
/* f0e1f24: 8fad0060 */ lw $t5,0x60($sp)
|
||||
/* f0e1f28: 25ae0008 */ addiu $t6,$t5,0x8
|
||||
/* f0e1f2c: afae0060 */ sw $t6,0x60($sp)
|
||||
/* f0e1f30: adaf0000 */ sw $t7,0x0($t5)
|
||||
/* f0e1f34: 0c012d20 */ jal osVirtualToPhysical
|
||||
/* f0e1f38: afad0034 */ sw $t5,0x34($sp)
|
||||
/* f0e1f3c: 8fa30034 */ lw $v1,0x34($sp)
|
||||
/* f0e1f40: 3c0d0450 */ lui $t5,0x450
|
||||
/* f0e1f44: 35ad0048 */ ori $t5,$t5,0x48
|
||||
/* f0e1f48: ac620004 */ sw $v0,0x4($v1)
|
||||
/* f0e1f4c: 8fb80060 */ lw $t8,0x60($sp)
|
||||
/* f0e1f50: 02002025 */ or $a0,$s0,$zero
|
||||
/* f0e1f54: 27190008 */ addiu $t9,$t8,0x8
|
||||
/* f0e1f58: afb90060 */ sw $t9,0x60($sp)
|
||||
/* f0e1f5c: af0d0000 */ sw $t5,0x0($t8)
|
||||
/* f0e1f60: 0c012d20 */ jal osVirtualToPhysical
|
||||
/* f0e1f64: afb80030 */ sw $t8,0x30($sp)
|
||||
/* f0e1f68: 8fa50030 */ lw $a1,0x30($sp)
|
||||
/* f0e1f6c: 3c18b100 */ lui $t8,0xb100
|
||||
/* f0e1f70: 3c195432 */ lui $t9,0x5432
|
||||
/* f0e1f74: aca20004 */ sw $v0,0x4($a1)
|
||||
/* f0e1f78: 8fae0060 */ lw $t6,0x60($sp)
|
||||
/* f0e1f7c: 37394510 */ ori $t9,$t9,0x4510
|
||||
/* f0e1f80: 37182405 */ ori $t8,$t8,0x2405
|
||||
/* f0e1f84: 25cf0008 */ addiu $t7,$t6,0x8
|
||||
/* f0e1f88: afaf0060 */ sw $t7,0x60($sp)
|
||||
/* f0e1f8c: add90004 */ sw $t9,0x4($t6)
|
||||
/* f0e1f90: add80000 */ sw $t8,0x0($t6)
|
||||
/* f0e1f94: 8fbf002c */ lw $ra,0x2c($sp)
|
||||
/* f0e1f98: 8fb10028 */ lw $s1,0x28($sp)
|
||||
/* f0e1f9c: 8fb00024 */ lw $s0,0x24($sp)
|
||||
/* f0e1fa0: 8fa20060 */ lw $v0,0x60($sp)
|
||||
/* f0e1fa4: 03e00008 */ jr $ra
|
||||
/* f0e1fa8: 27bd0060 */ addiu $sp,$sp,0x60
|
||||
);
|
||||
#else
|
||||
// Mismatch: Goal has the if statement with empty contents
|
||||
#define YMID() ((y1 + y2) / 2)
|
||||
|
||||
Gfx *menugfx_render_gradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colourstart, u32 colourmid, u32 colourend)
|
||||
{
|
||||
Col *colours = gfx_allocate_colours(3);
|
||||
Vtx *vertices = gfx_allocate_vertices(6);
|
||||
s32 ymid;
|
||||
s32 tmp;
|
||||
|
||||
gDPPipeSync(gdl++);
|
||||
gDPSetCycleType(gdl++, G_CYC_1CYCLE);
|
||||
@ -752,12 +569,15 @@ Gfx *menugfx_render_gradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colou
|
||||
|
||||
gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
|
||||
ymid = (y1 + y2) / 2;
|
||||
|
||||
if (x2 - x1 < ymid * 2) {
|
||||
ymid <<= 0;
|
||||
if (x2 - x1 + 1 <= YMID() * 2
|
||||
&& (u32) (x2 - x1) < YMID()
|
||||
&& (u32) (x2 - x1) < YMID()
|
||||
&& (u32) (x2 - x1) < YMID()) {
|
||||
tmp = 1;
|
||||
}
|
||||
|
||||
tmp = 0;
|
||||
|
||||
// 0 = top left
|
||||
// 1 = top right
|
||||
// 2 = bottom right
|
||||
@ -765,35 +585,35 @@ Gfx *menugfx_render_gradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colou
|
||||
// 4 = mid left
|
||||
// 5 = mid right
|
||||
|
||||
vertices[0].z = -10;
|
||||
vertices[1].z = -10;
|
||||
vertices[2].z = -10;
|
||||
vertices[3].z = -10;
|
||||
vertices[4].z = -10;
|
||||
vertices[5].z = -10;
|
||||
|
||||
vertices[0].x = x1 * 10;
|
||||
vertices[0].y = y1 * 10;
|
||||
vertices[0].colour = 0;
|
||||
vertices[0].z = -10;
|
||||
|
||||
vertices[1].x = x2 * 10;
|
||||
vertices[1].y = y1 * 10;
|
||||
vertices[1].colour = 0;
|
||||
vertices[1].z = -10;
|
||||
|
||||
vertices[2].x = x2 * 10;
|
||||
vertices[2].y = y2 * 10;
|
||||
vertices[2].colour = 4;
|
||||
vertices[2].z = -10;
|
||||
|
||||
vertices[3].x = x1 * 10;
|
||||
vertices[3].y = y2 * 10;
|
||||
vertices[3].z = -10;
|
||||
|
||||
vertices[4].x = (x1 + tmp) * 10;
|
||||
vertices[4].y = YMID() * 10;
|
||||
vertices[4].z = -10;
|
||||
|
||||
vertices[5].x = (x2 + tmp) * 10;
|
||||
vertices[5].y = YMID() * 10;
|
||||
vertices[5].z = -10;
|
||||
|
||||
vertices[0].colour = 0;
|
||||
vertices[1].colour = 0;
|
||||
vertices[2].colour = 4;
|
||||
vertices[3].colour = 4;
|
||||
|
||||
vertices[4].x = x1 * 10;
|
||||
vertices[4].y = ymid * 10;
|
||||
vertices[4].colour = 8;
|
||||
|
||||
vertices[5].x = x2 * 10;
|
||||
vertices[5].y = ymid * 10;
|
||||
vertices[5].colour = 8;
|
||||
|
||||
colours[0].word = colourstart;
|
||||
@ -806,7 +626,6 @@ Gfx *menugfx_render_gradient(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colou
|
||||
|
||||
return gdl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Gfx *menugfx_render_slider(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s32 markerx, u32 colour)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user