.include "macros.inc"
.section .text, "ax"
.global __GXSetDirtyState
__GXSetDirtyState:
mflr r0
stw r0, 4(r1)
stwu r1, -8(r1)
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
clrlwi. r0, r0, 0x1f
beq lbl_800A8828
bl __GXSetSUTexRegs
lbl_800A8828:
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
rlwinm. r0, r0, 0, 0x1e, 0x1e
beq lbl_800A883C
bl __GXUpdateBPMask
lbl_800A883C:
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
rlwinm. r0, r0, 0, 0x1d, 0x1d
beq lbl_800A8850
bl __GXSetGenMode
lbl_800A8850:
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
rlwinm. r0, r0, 0, 0x1c, 0x1c
beq lbl_800A8864
bl __GXSetVCD
lbl_800A8864:
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
rlwinm. r0, r0, 0, 0x1b, 0x1b
beq lbl_800A8878
bl __GXSetVAT
lbl_800A8878:
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
rlwinm. r0, r0, 0, 0x1b, 0x1c
beq lbl_800A888C
bl __GXCalculateVLim
lbl_800A888C:
lwz r3, gx@sda21(r13)
li r0, 0
stw r0, 0x4f4(r3)
lwz r0, 0xc(r1)
addi r1, r1, 8
mtlr r0
blr
.global GXBegin
GXBegin:
mflr r0
stw r0, 4(r1)
stwu r1, -0x28(r1)
stw r31, 0x24(r1)
addi r31, r5, 0
stw r30, 0x20(r1)
addi r30, r4, 0
stw r29, 0x1c(r1)
addi r29, r3, 0
lwz r6, gx@sda21(r13)
lwz r0, 0x4f4(r6)
cmplwi r0, 0
beq lbl_800A8958
clrlwi. r0, r0, 0x1f
beq lbl_800A88E8
bl __GXSetSUTexRegs
lbl_800A88E8:
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
rlwinm. r0, r0, 0, 0x1e, 0x1e
beq lbl_800A88FC
bl __GXUpdateBPMask
lbl_800A88FC:
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
rlwinm. r0, r0, 0, 0x1d, 0x1d
beq lbl_800A8910
bl __GXSetGenMode
lbl_800A8910:
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
rlwinm. r0, r0, 0, 0x1c, 0x1c
beq lbl_800A8924
bl __GXSetVCD
lbl_800A8924:
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
rlwinm. r0, r0, 0, 0x1b, 0x1b
beq lbl_800A8938
bl __GXSetVAT
lbl_800A8938:
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
rlwinm. r0, r0, 0, 0x1b, 0x1c
beq lbl_800A894C
bl __GXCalculateVLim
lbl_800A894C:
lwz r3, gx@sda21(r13)
li r0, 0
stw r0, 0x4f4(r3)
lbl_800A8958:
lwz r3, gx@sda21(r13)
lwz r0, 0(r3)
cmplwi r0, 0
bne lbl_800A896C
bl __GXSendFlushPrim
lbl_800A896C:
or r0, r30, r29
lis r3, 0xCC008000@ha
stb r0, 0xCC008000@l(r3)
sth r31, -0x8000(r3)
lwz r0, 0x2c(r1)
lwz r31, 0x24(r1)
lwz r30, 0x20(r1)
lwz r29, 0x1c(r1)
addi r1, r1, 0x28
mtlr r0
blr
.global __GXSendFlushPrim
__GXSendFlushPrim:
lwz r3, gx@sda21(r13)
li r0, 0x98
lis r5, 0xCC008000@ha
lhz r6, 4(r3)
li r4, 0
lhz r3, 6(r3)
mullw r7, r6, r3
stb r0, 0xCC008000@l(r5)
sth r6, -0x8000(r5)
addi r3, r7, 3
cmplwi r7, 0
srwi r3, r3, 2
ble lbl_800A8A10
rlwinm. r0, r3, 0x1d, 3, 0x1f
mtctr r0
beq lbl_800A8A04
lbl_800A89D8:
stw r4, -0x8000(r5)
stw r4, -0x8000(r5)
stw r4, -0x8000(r5)
stw r4, -0x8000(r5)
stw r4, -0x8000(r5)
stw r4, -0x8000(r5)
stw r4, -0x8000(r5)
stw r4, -0x8000(r5)
bdnz lbl_800A89D8
andi. r3, r3, 7
beq lbl_800A8A10
lbl_800A8A04:
mtctr r3
lbl_800A8A08:
stw r4, -0x8000(r5)
bdnz lbl_800A8A08
lbl_800A8A10:
lwz r3, gx@sda21(r13)
li r0, 1
sth r0, 2(r3)
blr
.global GXSetLineWidth
GXSetLineWidth:
lwz r5, gx@sda21(r13)
slwi r6, r4, 0x10
li r4, 0x61
lwz r0, 0x7c(r5)
addi r7, r5, 0x7c
lis r5, 0xCC008000@ha
rlwinm r0, r0, 0, 0, 0x17
rlwimi r0, r3, 0, 0x18, 0x1f
stw r0, 0(r7)
li r0, 0
lwz r3, gx@sda21(r13)
addi r7, r3, 0x7c
lwz r3, 0x7c(r3)
rlwinm r3, r3, 0, 0x10, 0xc
or r3, r3, r6
stw r3, 0(r7)
stb r4, 0xCC008000@l(r5)
lwz r4, gx@sda21(r13)
lwz r3, 0x7c(r4)
stw r3, -0x8000(r5)
sth r0, 2(r4)
blr
.global GXSetPointSize
GXSetPointSize:
lwz r5, gx@sda21(r13)
slwi r6, r4, 0x13
lwzu r0, 0x7c(r5)
li r4, 0x61
rlwinm r0, r0, 0, 0x18, 0xf
rlwimi r0, r3, 8, 0x10, 0x17
stw r0, 0(r5)
lis r5, 0xCC008000@ha
li r0, 0
lwz r3, gx@sda21(r13)
addi r7, r3, 0x7c
lwz r3, 0x7c(r3)
rlwinm r3, r3, 0, 0xd, 9
or r3, r3, r6
stw r3, 0(r7)
stb r4, 0xCC008000@l(r5)
lwz r4, gx@sda21(r13)
lwz r3, 0x7c(r4)
stw r3, -0x8000(r5)
sth r0, 2(r4)
blr
.global GXEnableTexOffsets
GXEnableTexOffsets:
lwz r0, gx@sda21(r13)
slwi r7, r3, 2
add r6, r0, r7
lwz r3, 0xb8(r6)
rlwinm r0, r4, 0x12, 6, 0xd
rlwinm r4, r5, 0x13, 5, 0xc
rlwinm r3, r3, 0, 0xe, 0xc
or r0, r3, r0
stw r0, 0xb8(r6)
li r3, 0x61
lis r5, 0xCC008000@ha
lwz r6, gx@sda21(r13)
li r0, 0
add r8, r6, r7
lwz r6, 0xb8(r8)
rlwinm r6, r6, 0, 0xd, 0xb
or r4, r6, r4
stw r4, 0xb8(r8)
lwz r4, gx@sda21(r13)
stb r3, 0xCC008000@l(r5)
add r3, r4, r7
lwz r3, 0xb8(r3)
stw r3, -0x8000(r5)
sth r0, 2(r4)
blr
.global GXSetCullMode
GXSetCullMode:
cmpwi r3, 2
beq lbl_800A8B50
bge lbl_800A8B54
cmpwi r3, 1
bge lbl_800A8B48
b lbl_800A8B54
lbl_800A8B48:
li r3, 2
b lbl_800A8B54
lbl_800A8B50:
li r3, 1
lbl_800A8B54:
lwz r4, gx@sda21(r13)
slwi r0, r3, 0xe
lwzu r3, 0x204(r4)
rlwinm r3, r3, 0, 0x12, 0xf
or r0, r3, r0
stw r0, 0(r4)
lwz r3, gx@sda21(r13)
lwz r0, 0x4f4(r3)
ori r0, r0, 4
stw r0, 0x4f4(r3)
blr
.global GXSetCoPlanar
GXSetCoPlanar:
lwz r4, gx@sda21(r13)
rlwinm r0, r3, 0x13, 5, 0xc
li r5, 0x61
lwz r3, 0x204(r4)
addi r6, r4, 0x204
lis r4, 0xCC008000@ha
rlwinm r3, r3, 0, 0xd, 0xb
or r0, r3, r0
stw r0, 0(r6)
lis r0, 0xfe08
stb r5, 0xCC008000@l(r4)
lwz r3, gx@sda21(r13)
stw r0, -0x8000(r4)
stb r5, -0x8000(r4)
lwz r0, 0x204(r3)
stw r0, -0x8000(r4)
blr
.global __GXSetGenMode
__GXSetGenMode:
li r0, 0x61
lwz r4, gx@sda21(r13)
lis r5, 0xCC008000@ha
stb r0, 0xCC008000@l(r5)
li r0, 0
lwz r3, 0x204(r4)
stw r3, -0x8000(r5)
sth r0, 2(r4)
blr