.include "macros.inc"
.section .text, "ax"
.global GXSetTevIndirect
GXSetTevIndirect:
stwu r1, -0x28(r1)
rlwinm r4, r4, 0, 0x1e, 0x1b
slwi r0, r5, 2
or r0, r4, r0
lwz r11, 0x34(r1)
rlwinm r5, r0, 0, 0x1c, 0x18
lbz r12, 0x33(r1)
slwi r0, r6, 4
lwz r4, gx@sda21(r13)
or r0, r5, r0
rlwinm r5, r0, 0, 0x19, 0x16
slwi r0, r11, 7
or r0, r5, r0
rlwinm r5, r0, 0, 0x17, 0x12
slwi r0, r7, 9
or r0, r5, r0
rlwinm r5, r0, 0, 0x13, 0xf
slwi r0, r8, 0xd
or r0, r5, r0
addi r5, r3, 0x10
rlwinm r3, r0, 0, 0x10, 0xc
slwi r0, r9, 0x10
or r0, r3, r0
rlwinm r3, r0, 0, 0xd, 0xb
slwi r0, r12, 0x13
or r0, r3, r0
rlwinm r3, r0, 0, 0xc, 0xa
rlwinm r0, r10, 0x14, 4, 0xb
or r6, r3, r0
li r0, 0x61
lis r3, 0xCC008000@ha
stb r0, 0xCC008000@l(r3)
slwi r0, r5, 0x18
rlwimi r0, r6, 0, 8, 0x1f
stw r0, -0x8000(r3)
li r0, 0
sth r0, 2(r4)
addi r1, r1, 0x28
blr
.global GXSetIndTexMtx
GXSetIndTexMtx:
cmpwi r3, 8
stwu r1, -0x78(r1)
beq lbl_800AB420
bge lbl_800AB3FC
cmpwi r3, 4
beq lbl_800AB420
bge lbl_800AB410
cmpwi r3, 1
bge lbl_800AB408
b lbl_800AB420
lbl_800AB3FC:
cmpwi r3, 0xc
bge lbl_800AB420
b lbl_800AB418
lbl_800AB408:
addi r0, r3, -1
b lbl_800AB424
lbl_800AB410:
addi r0, r3, -5
b lbl_800AB424
lbl_800AB418:
addi r0, r3, -9
b lbl_800AB424
lbl_800AB420:
li r0, 0
lbl_800AB424:
lfs f2, "@45"@sda21(r2)
mulli r3, r0, 3
lfs f1, 0(r4)
lfs f0, 0xc(r4)
fmuls f1, f2, f1
addi r11, r5, 0x11
fmuls f0, f2, f0
addi r0, r3, 6
extsb r11, r11
fctiwz f1, f1
li r10, 0x61
fctiwz f0, f0
lis r9, 0xCC008000@ha
stb r10, 0xCC008000@l(r9)
stfd f1, 0x70(r1)
slwi r0, r0, 0x18
addi r6, r3, 7
stfd f0, 0x68(r1)
addi r5, r3, 8
lwz r8, 0x74(r1)
lwz r7, 0x6c(r1)
lwz r3, gx@sda21(r13)
rlwinm r7, r7, 0xb, 0xa, 0x14
rlwimi r7, r8, 0, 0x15, 0x1f
rlwinm r7, r7, 0, 0xa, 7
rlwimi r7, r11, 0x16, 8, 9
rlwimi r0, r7, 0, 8, 0x1f
stw r0, -0x8000(r9)
li r0, 0
lfs f1, 4(r4)
lfs f0, 0x10(r4)
fmuls f1, f2, f1
fmuls f0, f2, f0
stb r10, -0x8000(r9)
fctiwz f1, f1
fctiwz f0, f0
stfd f1, 0x60(r1)
stfd f0, 0x58(r1)
lwz r8, 0x64(r1)
lwz r7, 0x5c(r1)
rlwinm r7, r7, 0xb, 0xa, 0x14
rlwimi r7, r8, 0, 0x15, 0x1f
rlwinm r7, r7, 0, 0xa, 7
rlwimi r7, r11, 0x14, 8, 9
clrlwi r7, r7, 8
rlwimi r7, r6, 0x18, 0, 7
stw r7, -0x8000(r9)
lfs f1, 8(r4)
lfs f0, 0x14(r4)
fmuls f1, f2, f1
fmuls f0, f2, f0
stb r10, -0x8000(r9)
fctiwz f1, f1
fctiwz f0, f0
stfd f1, 0x50(r1)
stfd f0, 0x48(r1)
lwz r6, 0x54(r1)
lwz r4, 0x4c(r1)
rlwinm r4, r4, 0xb, 0xa, 0x14
rlwimi r4, r6, 0, 0x15, 0x1f
rlwinm r4, r4, 0, 0xa, 7
rlwimi r4, r11, 0x12, 8, 9
clrlwi r4, r4, 8
rlwimi r4, r5, 0x18, 0, 7
stw r4, -0x8000(r9)
sth r0, 2(r3)
addi r1, r1, 0x78
blr
.global GXSetIndTexCoordScale
GXSetIndTexCoordScale:
cmpwi r3, 2
beq lbl_800AB62C
bge lbl_800AB550
cmpwi r3, 0
beq lbl_800AB55C
bge lbl_800AB5C4
b lbl_800AB6F8
lbl_800AB550:
cmpwi r3, 4
bge lbl_800AB6F8
b lbl_800AB694
lbl_800AB55C:
lwz r6, gx@sda21(r13)
slwi r3, r5, 4
li r0, 0x61
addi r7, r6, 0x128
lwz r6, 0x128(r6)
lis r5, 0xCC008000@ha
rlwinm r6, r6, 0, 0, 0x1b
or r4, r6, r4
stw r4, 0(r7)
lwz r4, gx@sda21(r13)
addi r6, r4, 0x128
lwz r4, 0x128(r4)
rlwinm r4, r4, 0, 0x1c, 0x17
or r3, r4, r3
stw r3, 0(r6)
lwz r3, gx@sda21(r13)
addi r4, r3, 0x128
lwz r3, 0x128(r3)
clrlwi r3, r3, 8
oris r3, r3, 0x2500
stw r3, 0(r4)
stb r0, 0xCC008000@l(r5)
lwz r3, gx@sda21(r13)
lwz r0, 0x128(r3)
stw r0, -0x8000(r5)
b lbl_800AB6F8
lbl_800AB5C4:
lwz r7, gx@sda21(r13)
slwi r3, r5, 0xc
lwzu r5, 0x128(r7)
slwi r6, r4, 8
li r0, 0x61
rlwinm r5, r5, 0, 0x18, 0x13
or r5, r5, r6
stw r5, 0(r7)
lis r4, 0xCC008000@ha
lwz r5, gx@sda21(r13)
addi r6, r5, 0x128
lwz r5, 0x128(r5)
rlwinm r5, r5, 0, 0x14, 0xf
or r3, r5, r3
stw r3, 0(r6)
lwz r3, gx@sda21(r13)
addi r5, r3, 0x128
lwz r3, 0x128(r3)
clrlwi r3, r3, 8
oris r3, r3, 0x2500
stw r3, 0(r5)
stb r0, 0xCC008000@l(r4)
lwz r3, gx@sda21(r13)
lwz r0, 0x128(r3)
stw r0, -0x8000(r4)
b lbl_800AB6F8
lbl_800AB62C:
lwz r6, gx@sda21(r13)
slwi r3, r5, 4
li r0, 0x61
addi r7, r6, 0x12c
lwz r6, 0x12c(r6)
lis r5, 0xCC008000@ha
rlwinm r6, r6, 0, 0, 0x1b
or r4, r6, r4
stw r4, 0(r7)
lwz r4, gx@sda21(r13)
addi r6, r4, 0x12c
lwz r4, 0x12c(r4)
rlwinm r4, r4, 0, 0x1c, 0x17
or r3, r4, r3
stw r3, 0(r6)
lwz r3, gx@sda21(r13)
addi r4, r3, 0x12c
lwz r3, 0x12c(r3)
clrlwi r3, r3, 8
oris r3, r3, 0x2600
stw r3, 0(r4)
stb r0, 0xCC008000@l(r5)
lwz r3, gx@sda21(r13)
lwz r0, 0x12c(r3)
stw r0, -0x8000(r5)
b lbl_800AB6F8
lbl_800AB694:
lwz r7, gx@sda21(r13)
slwi r3, r5, 0xc
lwzu r5, 0x12c(r7)
slwi r6, r4, 8
li r0, 0x61
rlwinm r5, r5, 0, 0x18, 0x13
or r5, r5, r6
stw r5, 0(r7)
lis r4, 0xCC008000@ha
lwz r5, gx@sda21(r13)
addi r6, r5, 0x12c
lwz r5, 0x12c(r5)
rlwinm r5, r5, 0, 0x14, 0xf
or r3, r5, r3
stw r3, 0(r6)
lwz r3, gx@sda21(r13)
addi r5, r3, 0x12c
lwz r3, 0x12c(r3)
clrlwi r3, r3, 8
oris r3, r3, 0x2600
stw r3, 0(r5)
stb r0, 0xCC008000@l(r4)
lwz r3, gx@sda21(r13)
lwz r0, 0x12c(r3)
stw r0, -0x8000(r4)
lbl_800AB6F8:
lwz r3, gx@sda21(r13)
li r0, 0
sth r0, 2(r3)
blr
.global GXSetIndTexOrder
GXSetIndTexOrder:
cmpwi r3, 2
beq lbl_800AB7A0
bge lbl_800AB724
cmpwi r3, 0
beq lbl_800AB730
bge lbl_800AB768
b lbl_800AB80C
lbl_800AB724:
cmpwi r3, 4
bge lbl_800AB80C
b lbl_800AB7D8
lbl_800AB730:
lwz r3, gx@sda21(r13)
slwi r0, r4, 3
addi r4, r3, 0x120
lwz r3, 0x120(r3)
rlwinm r3, r3, 0, 0, 0x1c
or r3, r3, r5
stw r3, 0(r4)
lwz r3, gx@sda21(r13)
addi r4, r3, 0x120
lwz r3, 0x120(r3)
rlwinm r3, r3, 0, 0x1d, 0x19
or r0, r3, r0
stw r0, 0(r4)
b lbl_800AB80C
lbl_800AB768:
lwz r6, gx@sda21(r13)
slwi r0, r4, 9
slwi r3, r5, 6
lwz r4, 0x120(r6)
rlwinm r4, r4, 0, 0x1a, 0x16
or r3, r4, r3
stw r3, 0x120(r6)
lwz r3, gx@sda21(r13)
addi r4, r3, 0x120
lwz r3, 0x120(r3)
rlwinm r3, r3, 0, 0x17, 0x13
or r0, r3, r0
stw r0, 0(r4)
b lbl_800AB80C
lbl_800AB7A0:
lwz r6, gx@sda21(r13)
slwi r0, r4, 0xf
slwi r3, r5, 0xc
lwz r4, 0x120(r6)
rlwinm r4, r4, 0, 0x14, 0x10
or r3, r4, r3
stw r3, 0x120(r6)
lwz r3, gx@sda21(r13)
addi r4, r3, 0x120
lwz r3, 0x120(r3)
rlwinm r3, r3, 0, 0x11, 0xd
or r0, r3, r0
stw r0, 0(r4)
b lbl_800AB80C
lbl_800AB7D8:
lwz r6, gx@sda21(r13)
slwi r0, r4, 0x15
slwi r3, r5, 0x12
lwz r4, 0x120(r6)
rlwinm r4, r4, 0, 0xe, 0xa
or r3, r4, r3
stw r3, 0x120(r6)
lwz r3, gx@sda21(r13)
addi r4, r3, 0x120
lwz r3, 0x120(r3)
rlwinm r3, r3, 0, 0xb, 7
or r0, r3, r0
stw r0, 0(r4)
lbl_800AB80C:
li r0, 0x61
lwz r4, gx@sda21(r13)
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
li r0, 0
lwz r3, 0x120(r4)
stw r3, -0x8000(r5)
lwz r3, 0x4f4(r4)
ori r3, r3, 3
stw r3, 0x4f4(r4)
lwz r3, gx@sda21(r13)
sth r0, 2(r3)
blr
.global GXSetNumIndStages
GXSetNumIndStages:
lwz r4, gx@sda21(r13)
rlwinm r0, r3, 0x10, 8, 0xf
lwzu r3, 0x204(r4)
rlwinm r3, r3, 0, 0x10, 0xc
or r0, r3, r0
stw r0, 0(r4)
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
ori r0, r0, 6
stw r0, 0x4f4(r3)
blr
.global GXSetTevDirect
GXSetTevDirect:
mflr r0
li r4, 0
stw r0, 4(r1)
li r0, 0
li r5, 0
stwu r1, -0x18(r1)
li r6, 0
li r7, 0
stw r0, 8(r1)
li r8, 0
li r9, 0
stw r0, 0xc(r1)
li r10, 0
bl GXSetTevIndirect
lwz r0, 0x1c(r1)
addi r1, r1, 0x18
mtlr r0
blr
.global GXSetTevIndWarp
GXSetTevIndWarp:
mflr r0
stw r0, 4(r1)
clrlwi. r0, r6, 0x18
stwu r1, -0x20(r1)
beq lbl_800AB8D0
li r6, 6
b lbl_800AB8D4
lbl_800AB8D0:
li r6, 0
lbl_800AB8D4:
clrlwi. r0, r5, 0x18
addi r8, r6, 0
beq lbl_800AB8E8
li r6, 7
b lbl_800AB8EC
lbl_800AB8E8:
li r6, 0
lbl_800AB8EC:
li r0, 0
stw r0, 8(r1)
addi r9, r8, 0
li r5, 0
stw r0, 0xc(r1)
li r10, 0
bl GXSetTevIndirect
lwz r0, 0x24(r1)
addi r1, r1, 0x20
mtlr r0
blr
.global __GXUpdateBPMask
__GXUpdateBPMask:
lwz r3, gx@sda21(r13)
li r6, 0
li r4, 0
lwz r0, 0x204(r3)
rlwinm r0, r0, 0x10, 0x1d, 0x1f
cmplwi r0, 0
mtctr r0
ble lbl_800AB9A0
lbl_800AB938:
cmpwi r4, 2
beq lbl_800AB978
bge lbl_800AB954
cmpwi r4, 0
beq lbl_800AB960
bge lbl_800AB96C
b lbl_800AB98C
lbl_800AB954:
cmpwi r4, 4
bge lbl_800AB98C
b lbl_800AB984
lbl_800AB960:
lwz r0, 0x120(r3)
clrlwi r5, r0, 0x1d
b lbl_800AB98C
lbl_800AB96C:
lwz r0, 0x120(r3)
rlwinm r5, r0, 0x1a, 0x1d, 0x1f
b lbl_800AB98C
lbl_800AB978:
lwz r0, 0x120(r3)
rlwinm r5, r0, 0x14, 0x1d, 0x1f
b lbl_800AB98C
lbl_800AB984:
lwz r0, 0x120(r3)
rlwinm r5, r0, 0xe, 0x1d, 0x1f
lbl_800AB98C:
li r0, 1
slw r0, r0, r5
or r6, r6, r0
addi r4, r4, 1
bdnz lbl_800AB938
lbl_800AB9A0:
addi r4, r3, 0x124
lwz r3, 0x124(r3)
clrlwi r0, r3, 0x18
cmplw r0, r6
beqlr
rlwinm r0, r3, 0, 0, 0x17
or r0, r0, r6
stw r0, 0(r4)
li r0, 0x61
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
li r0, 0
lwz r4, gx@sda21(r13)
lwz r3, 0x124(r4)
stw r3, -0x8000(r5)
sth r0, 2(r4)
blr
.global __GXFlushTextureState
__GXFlushTextureState:
li r0, 0x61
lwz r4, gx@sda21(r13)
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
li r0, 0
lwz r3, 0x124(r4)
stw r3, -0x8000(r5)
sth r0, 2(r4)
blr
.section .sdata2, "a"
.balign 8
"@45":
.4byte 0x44800000
.4byte 0