DolphinCGraphics nearly done

This commit is contained in:
Luke Street 2022-12-06 18:32:47 -05:00
parent 64402f5155
commit d065d80388
17 changed files with 393 additions and 99 deletions

View File

@ -94,7 +94,7 @@ mBrightnessMax__9CGraphics:
.balign 8
.lcomm sSpareFrameBuffer, 0x46000, 4
.lcomm kEnvBlendCTandCConCF, 0x50, 4
.lcomm kEnvBlendCTandCConCF, 0x4C, 4
.comm kEnvModulateConstColor__9CGraphics, 0x4C, 4
.comm lbl_805A56E4, 0x78C, 4 # MWCC .comm bug
.comm kEnvConstColor__9CGraphics, 0x4C, 4
@ -245,14 +245,14 @@ mSecondsMod900__9CGraphics:
.global mpExternalTimeProvider__9CGraphics
mpExternalTimeProvider__9CGraphics:
.skip 0x4
.global lbl_805A9408
lbl_805A9408:
.global mScreenStretch__9CGraphics
mScreenStretch__9CGraphics:
.skip 0x4
.global lbl_805A940C
lbl_805A940C:
.global mScreenPositionX__9CGraphics
mScreenPositionX__9CGraphics:
.skip 0x4
.global lbl_805A9410
lbl_805A9410:
.global mScreenPositionY__9CGraphics
mScreenPositionY__9CGraphics:
.skip 0x4
.global "nextTexRgn$2336"
"nextTexRgn$2336":
@ -406,8 +406,8 @@ SetIsBeginSceneClearFb__9CGraphicsFb:
/* 803094A8 00306408 98 6D 9C 6C */ stb r3, mIsBeginSceneClearFb__9CGraphics@sda21(r13)
/* 803094AC 0030640C 4E 80 00 20 */ blr
.global sub_803094b0__9CGraphicsFUiUiUi
sub_803094b0__9CGraphicsFUiUiUi:
.global SetScreenPosition__9CGraphicsFiii
SetScreenPosition__9CGraphicsFiii:
/* 803094B0 00306410 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 803094B4 00306414 7C 08 02 A6 */ mflr r0
/* 803094B8 00306418 90 01 00 24 */ stw r0, 0x24(r1)
@ -417,10 +417,10 @@ sub_803094b0__9CGraphicsFUiUiUi:
/* 803094C8 00306428 7C 7E 1B 78 */ mr r30, r3
/* 803094CC 0030642C 93 A1 00 14 */ stw r29, 0x14(r1)
/* 803094D0 00306430 7C BD 2B 78 */ mr r29, r5
/* 803094D4 00306434 80 0D A8 48 */ lwz r0, lbl_805A9408@sda21(r13)
/* 803094D8 00306438 80 6D A8 4C */ lwz r3, lbl_805A940C@sda21(r13)
/* 803094D4 00306434 80 0D A8 48 */ lwz r0, mScreenStretch__9CGraphics@sda21(r13)
/* 803094D8 00306438 80 6D A8 4C */ lwz r3, mScreenPositionX__9CGraphics@sda21(r13)
/* 803094DC 0030643C 7C 80 F0 51 */ subf. r4, r0, r30
/* 803094E0 00306440 80 0D A8 50 */ lwz r0, lbl_805A9410@sda21(r13)
/* 803094E0 00306440 80 0D A8 50 */ lwz r0, mScreenPositionY__9CGraphics@sda21(r13)
/* 803094E4 00306444 7C A3 F8 50 */ subf r5, r3, r31
/* 803094E8 00306448 7C E0 E8 50 */ subf r7, r0, r29
/* 803094EC 0030644C 40 82 00 14 */ bne lbl_80309500
@ -444,9 +444,9 @@ lbl_80309500:
/* 80309530 00306490 B0 03 00 0C */ sth r0, 0xc(r3)
/* 80309534 00306494 48 07 F0 21 */ bl VIConfigure
/* 80309538 00306498 48 07 FB D9 */ bl VIFlush
/* 8030953C 0030649C 93 CD A8 48 */ stw r30, lbl_805A9408@sda21(r13)
/* 80309540 003064A0 93 ED A8 4C */ stw r31, lbl_805A940C@sda21(r13)
/* 80309544 003064A4 93 AD A8 50 */ stw r29, lbl_805A9410@sda21(r13)
/* 8030953C 0030649C 93 CD A8 48 */ stw r30, mScreenStretch__9CGraphics@sda21(r13)
/* 80309540 003064A0 93 ED A8 4C */ stw r31, mScreenPositionX__9CGraphics@sda21(r13)
/* 80309544 003064A4 93 AD A8 50 */ stw r29, mScreenPositionY__9CGraphics@sda21(r13)
lbl_80309548:
/* 80309548 003064A8 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8030954C 003064AC 83 E1 00 1C */ lwz r31, 0x1c(r1)
@ -456,21 +456,21 @@ lbl_80309548:
/* 8030955C 003064BC 38 21 00 20 */ addi r1, r1, 0x20
/* 80309560 003064C0 4E 80 00 20 */ blr
.global sub_80309564__9CGraphicsFPUiPUiPUi
sub_80309564__9CGraphicsFPUiPUiPUi:
.global GetScreenPosition__9CGraphicsFPiPiPi
GetScreenPosition__9CGraphicsFPiPiPi:
/* 80309564 003064C4 28 03 00 00 */ cmplwi r3, 0
/* 80309568 003064C8 41 82 00 0C */ beq lbl_80309574
/* 8030956C 003064CC 80 0D A8 48 */ lwz r0, lbl_805A9408@sda21(r13)
/* 8030956C 003064CC 80 0D A8 48 */ lwz r0, mScreenStretch__9CGraphics@sda21(r13)
/* 80309570 003064D0 90 03 00 00 */ stw r0, 0(r3)
lbl_80309574:
/* 80309574 003064D4 28 04 00 00 */ cmplwi r4, 0
/* 80309578 003064D8 41 82 00 0C */ beq lbl_80309584
/* 8030957C 003064DC 80 0D A8 4C */ lwz r0, lbl_805A940C@sda21(r13)
/* 8030957C 003064DC 80 0D A8 4C */ lwz r0, mScreenPositionX__9CGraphics@sda21(r13)
/* 80309580 003064E0 90 04 00 00 */ stw r0, 0(r4)
lbl_80309584:
/* 80309584 003064E4 28 05 00 00 */ cmplwi r5, 0
/* 80309588 003064E8 4D 82 00 20 */ beqlr
/* 8030958C 003064EC 80 0D A8 50 */ lwz r0, lbl_805A9410@sda21(r13)
/* 8030958C 003064EC 80 0D A8 50 */ lwz r0, mScreenPositionY__9CGraphics@sda21(r13)
/* 80309590 003064F0 90 05 00 00 */ stw r0, 0(r5)
/* 80309594 003064F4 4E 80 00 20 */ blr
@ -5532,8 +5532,8 @@ __ct__14CGXLightParamsFv:
.section .sdata2, "a"
.balign 8
.global lbl_805AE4C8
lbl_805AE4C8:
.global kSpareBufferTexMapID__9CGraphics
kSpareBufferTexMapID__9CGraphics:
# ROM: 0x3FAD68
.4byte 0x00000007

View File

@ -2391,7 +2391,7 @@ lbl_80319454:
/* 80319708 00316668 38 A0 00 00 */ li r5, 0
/* 8031970C 0031666C 38 C0 00 04 */ li r6, 4
/* 80319710 00316670 4B FE F2 3D */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 80319714 00316674 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 80319714 00316674 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 80319718 00316678 38 60 00 01 */ li r3, 1
/* 8031971C 0031667C 38 80 00 01 */ li r4, 1
/* 80319720 00316680 38 C0 00 04 */ li r6, 4
@ -2754,7 +2754,7 @@ lbl_80319B98:
/* 80319C7C 00316BDC 7F 03 C3 78 */ mr r3, r24
/* 80319C80 00316BE0 4B FE FB 8D */ bl SetUseVideoFilter__9CGraphicsFb
/* 80319C84 00316BE4 48 05 E8 E1 */ bl GXPixModeSync
/* 80319C88 00316BE8 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 80319C88 00316BE8 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 80319C8C 00316BEC 7E C3 B3 78 */ mr r3, r22
/* 80319C90 00316BF0 7E E4 BB 78 */ mr r4, r23
/* 80319C94 00316BF4 38 A0 00 04 */ li r5, 4

View File

@ -690,7 +690,7 @@ ReallyDrawPhazonSuitIndirectEffect__13CCubeRendererFRC6CColorRC8CTextureRC8CText
lbl_802B6330:
/* 802B6330 002B3290 80 CD A8 28 */ lwz r6, mpSpareBuffer__9CGraphics@sda21(r13)
/* 802B6334 002B3294 38 A0 00 04 */ li r5, 4
/* 802B6338 002B3298 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 802B6338 002B3298 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802B633C 002B329C 48 05 3C E5 */ bl LoadDolphinSpareTexture__9CGraphicsFii9_GXTexFmtPv11_GXTexMapID
/* 802B6340 002B32A0 7F 63 DB 78 */ mr r3, r27
/* 802B6344 002B32A4 38 80 00 01 */ li r4, 1
@ -762,7 +762,7 @@ lbl_802B6330:
/* 802B644C 002B33AC 38 E0 00 00 */ li r7, 0
/* 802B6450 002B33B0 39 00 00 7D */ li r8, 0x7d
/* 802B6454 002B33B4 48 05 22 79 */ bl SetTexCoordGen__3CGXF13_GXTexCoordID13_GXTexGenType12_GXTexGenSrc9_GXTexMtxUc11_GXPTTexMtx
/* 802B6458 002B33B8 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 802B6458 002B33B8 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802B645C 002B33BC 38 60 00 00 */ li r3, 0
/* 802B6460 002B33C0 38 80 00 00 */ li r4, 0
/* 802B6464 002B33C4 38 C0 00 FF */ li r6, 0xff
@ -1087,7 +1087,7 @@ ReallyDrawPhazonSuitEffect__13CCubeRendererFRC6CColorRC8CTexture:
/* 802B6940 002B38A0 90 01 00 34 */ stw r0, 0x34(r1)
/* 802B6944 002B38A4 93 E1 00 2C */ stw r31, 0x2c(r1)
/* 802B6948 002B38A8 7C 9F 23 78 */ mr r31, r4
/* 802B694C 002B38AC 80 82 C7 A8 */ lwz r4, lbl_805AE4C8@sda21(r2)
/* 802B694C 002B38AC 80 82 C7 A8 */ lwz r4, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802B6950 002B38B0 93 C1 00 28 */ stw r30, 0x28(r1)
/* 802B6954 002B38B4 7C 7E 1B 78 */ mr r30, r3
/* 802B6958 002B38B8 7C A3 2B 78 */ mr r3, r5
@ -1124,7 +1124,7 @@ ReallyDrawPhazonSuitEffect__13CCubeRendererFRC6CColorRC8CTexture:
/* 802B69D4 002B3934 48 05 24 41 */ bl SetNumTexGens__3CGXFUc
/* 802B69D8 002B3938 38 60 00 01 */ li r3, 1
/* 802B69DC 002B393C 48 05 22 B5 */ bl SetNumTevStages__3CGXFUc
/* 802B69E0 002B3940 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 802B69E0 002B3940 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802B69E4 002B3944 38 60 00 00 */ li r3, 0
/* 802B69E8 002B3948 38 80 00 00 */ li r4, 0
/* 802B69EC 002B394C 38 C0 00 04 */ li r6, 4
@ -1291,7 +1291,7 @@ DoPhazonSuitIndirectAlphaBlur__13CCubeRendererFff:
/* 802B6C64 002B3BC4 7C 66 1B 78 */ mr r6, r3
/* 802B6C68 002B3BC8 7C 83 0E 70 */ srawi r3, r4, 1
/* 802B6C6C 002B3BCC 7C 00 FA 14 */ add r0, r0, r31
/* 802B6C70 002B3BD0 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 802B6C70 002B3BD0 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802B6C74 002B3BD4 7C 04 0E 70 */ srawi r4, r0, 1
/* 802B6C78 002B3BD8 38 A0 00 01 */ li r5, 1
/* 802B6C7C 002B3BDC 48 05 33 A5 */ bl LoadDolphinSpareTexture__9CGraphicsFii9_GXTexFmtPv11_GXTexMapID
@ -1321,7 +1321,7 @@ DoPhazonSuitIndirectAlphaBlur__13CCubeRendererFff:
/* 802B6CDC 002B3C3C 48 05 21 39 */ bl SetNumTexGens__3CGXFUc
/* 802B6CE0 002B3C40 38 60 00 01 */ li r3, 1
/* 802B6CE4 002B3C44 48 05 1F AD */ bl SetNumTevStages__3CGXFUc
/* 802B6CE8 002B3C48 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 802B6CE8 002B3C48 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802B6CEC 002B3C4C 38 60 00 00 */ li r3, 0
/* 802B6CF0 002B3C50 38 80 00 00 */ li r4, 0
/* 802B6CF4 002B3C54 38 C0 00 04 */ li r6, 4
@ -1435,7 +1435,7 @@ DoPhazonSuitIndirectAlphaBlur__13CCubeRendererFff:
/* 802B6EA4 002B3E04 7F BE 16 70 */ srawi r30, r29, 2
/* 802B6EA8 002B3E08 7C 66 1B 78 */ mr r6, r3
/* 802B6EAC 002B3E0C 7F FF 16 70 */ srawi r31, r31, 2
/* 802B6EB0 002B3E10 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 802B6EB0 002B3E10 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802B6EB4 002B3E14 7F C3 F3 78 */ mr r3, r30
/* 802B6EB8 002B3E18 38 A0 00 01 */ li r5, 1
/* 802B6EBC 002B3E1C 7F E4 FB 78 */ mr r4, r31
@ -1637,7 +1637,7 @@ lbl_802B6FAC:
/* 802B71C8 002B4128 48 0C 4D 39 */ bl GXSetColorUpdate
/* 802B71CC 002B412C 38 60 00 08 */ li r3, 8
/* 802B71D0 002B4130 48 00 02 85 */ bl GetRenderToTexBuffer__13CCubeRendererFi
/* 802B71D4 002B4134 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 802B71D4 002B4134 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802B71D8 002B4138 7C 66 1B 78 */ mr r6, r3
/* 802B71DC 002B413C 7F C3 F3 78 */ mr r3, r30
/* 802B71E0 002B4140 7F E4 FB 78 */ mr r4, r31
@ -5221,7 +5221,7 @@ DoThermalBlendHot__13CCubeRendererFv:
/* 802BA538 002B7498 48 0B EF FD */ bl GXCopyTex
/* 802BA53C 002B749C 38 7A 02 88 */ addi r3, r26, 0x288
/* 802BA540 002B74A0 48 05 39 85 */ bl Load__16CGraphicsPaletteCFv
/* 802BA544 002B74A4 81 02 C7 A8 */ lwz r8, lbl_805AE4C8@sda21(r2)
/* 802BA544 002B74A4 81 02 C7 A8 */ lwz r8, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802BA548 002B74A8 7F E3 FB 78 */ mr r3, r31
/* 802BA54C 002B74AC 7F C4 F3 78 */ mr r4, r30
/* 802BA550 002B74B0 38 A0 00 08 */ li r5, 8
@ -5242,7 +5242,7 @@ DoThermalBlendHot__13CCubeRendererFv:
/* 802BA58C 002B74EC 48 04 E6 09 */ bl SetTevAlphaIn__3CGXF13_GXTevStageID14_GXTevAlphaArg14_GXTevAlphaArg14_GXTevAlphaArg14_GXTevAlphaArg
/* 802BA590 002B74F0 38 60 00 00 */ li r3, 0
/* 802BA594 002B74F4 48 04 D6 BD */ bl SetStandardTevColorAlphaOp__3CGXF13_GXTevStageID
/* 802BA598 002B74F8 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 802BA598 002B74F8 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802BA59C 002B74FC 38 60 00 00 */ li r3, 0
/* 802BA5A0 002B7500 38 80 00 00 */ li r4, 0
/* 802BA5A4 002B7504 38 C0 00 FF */ li r6, 0xff
@ -5440,7 +5440,7 @@ DoThermalBlendCold__13CCubeRendererFv:
/* 802BA898 002B77F8 7F 43 D3 78 */ mr r3, r26
/* 802BA89C 002B77FC 38 80 00 01 */ li r4, 1
/* 802BA8A0 002B7800 48 0B EC 95 */ bl GXCopyTex
/* 802BA8A4 002B7804 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 802BA8A4 002B7804 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802BA8A8 002B7808 7F C3 F3 78 */ mr r3, r30
/* 802BA8AC 002B780C 7F A4 EB 78 */ mr r4, r29
/* 802BA8B0 002B7810 38 A0 00 00 */ li r5, 0
@ -5600,7 +5600,7 @@ lbl_802BAA1C:
/* 802BAB08 002B7A68 48 04 E0 8D */ bl SetTevAlphaIn__3CGXF13_GXTevStageID14_GXTevAlphaArg14_GXTevAlphaArg14_GXTevAlphaArg14_GXTevAlphaArg
/* 802BAB0C 002B7A6C 38 60 00 00 */ li r3, 0
/* 802BAB10 002B7A70 48 04 D1 41 */ bl SetStandardTevColorAlphaOp__3CGXF13_GXTevStageID
/* 802BAB14 002B7A74 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 802BAB14 002B7A74 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802BAB18 002B7A78 38 60 00 00 */ li r3, 0
/* 802BAB1C 002B7A7C 38 80 00 00 */ li r4, 0
/* 802BAB20 002B7A80 38 C0 00 FF */ li r6, 0xff
@ -6980,7 +6980,7 @@ lbl_802BBEB8:
/* 802BBF48 002B8EA8 38 A0 00 06 */ li r5, 6
/* 802BBF4C 002B8EAC 80 81 00 54 */ lwz r4, 0x54(r1)
/* 802BBF50 002B8EB0 38 C0 00 00 */ li r6, 0
/* 802BBF54 002B8EB4 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 802BBF54 002B8EB4 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802BBF58 002B8EB8 48 04 E0 C9 */ bl LoadDolphinSpareTexture__9CGraphicsFii9_GXTexFmtPv11_GXTexMapID
/* 802BBF5C 002B8EBC 38 7B 01 50 */ addi r3, r27, 0x150
/* 802BBF60 002B8EC0 38 80 00 01 */ li r4, 1
@ -7013,7 +7013,7 @@ lbl_802BBEB8:
/* 802BBFCC 002B8F2C 38 E0 00 00 */ li r7, 0
/* 802BBFD0 002B8F30 39 00 00 7D */ li r8, 0x7d
/* 802BBFD4 002B8F34 48 04 C6 F9 */ bl SetTexCoordGen__3CGXF13_GXTexCoordID13_GXTexGenType12_GXTexGenSrc9_GXTexMtxUc11_GXPTTexMtx
/* 802BBFD8 002B8F38 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 802BBFD8 002B8F38 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 802BBFDC 002B8F3C 38 60 00 00 */ li r3, 0
/* 802BBFE0 002B8F40 38 80 00 00 */ li r4, 0
/* 802BBFE4 002B8F44 38 C0 00 FF */ li r6, 0xff

View File

@ -1096,7 +1096,7 @@ lbl_80209B80:
/* 80209C88 00206BE8 7D 89 03 A6 */ mtctr r12
/* 80209C8C 00206BEC 4E 80 04 21 */ bctrl
/* 80209C90 00206BF0 48 16 E8 D5 */ bl GXPixModeSync
/* 80209C94 00206BF4 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 80209C94 00206BF4 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 80209C98 00206BF8 7F E3 FB 78 */ mr r3, r31
/* 80209C9C 00206BFC 7F C4 F3 78 */ mr r4, r30
/* 80209CA0 00206C00 7F 46 D3 78 */ mr r6, r26
@ -1133,7 +1133,7 @@ lbl_80209B80:
/* 80209D1C 00206C7C 38 C0 00 07 */ li r6, 7
/* 80209D20 00206C80 38 E0 00 01 */ li r7, 1
/* 80209D24 00206C84 48 0F EE 71 */ bl SetTevAlphaIn__3CGXF13_GXTevStageID14_GXTevAlphaArg14_GXTevAlphaArg14_GXTevAlphaArg14_GXTevAlphaArg
/* 80209D28 00206C88 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 80209D28 00206C88 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 80209D2C 00206C8C 38 60 00 00 */ li r3, 0
/* 80209D30 00206C90 38 80 00 00 */ li r4, 0
/* 80209D34 00206C94 38 C0 00 FF */ li r6, 0xff

View File

@ -410,7 +410,7 @@ lbl_800EABEC:
/* 800EAC00 000E7B60 48 00 00 08 */ b lbl_800EAC08
/* 800EAC04 000E7B64 48 00 0C CC */ b lbl_800EB8D0
lbl_800EAC08:
/* 800EAC08 000E7B68 81 02 C7 A8 */ lwz r8, lbl_805AE4C8@sda21(r2)
/* 800EAC08 000E7B68 81 02 C7 A8 */ lwz r8, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EAC0C 000E7B6C 7F C7 F3 78 */ mr r7, r30
/* 800EAC10 000E7B70 57 63 04 3E */ clrlwi r3, r27, 0x10
/* 800EAC14 000E7B74 57 44 04 3E */ clrlwi r4, r26, 0x10
@ -419,7 +419,7 @@ lbl_800EAC08:
/* 800EAC20 000E7B80 48 21 F3 49 */ bl LoadDolphinSpareTexture__9CGraphicsFii11_GXCITexFmt7_GXTlutPv11_GXTexMapID
/* 800EAC24 000E7B84 48 00 00 1C */ b lbl_800EAC40
lbl_800EAC28:
/* 800EAC28 000E7B88 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 800EAC28 000E7B88 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EAC2C 000E7B8C 7F 85 E3 78 */ mr r5, r28
/* 800EAC30 000E7B90 7F C6 F3 78 */ mr r6, r30
/* 800EAC34 000E7B94 57 63 04 3E */ clrlwi r3, r27, 0x10
@ -546,42 +546,42 @@ lbl_800EAD9C:
/* 800EAE10 000E7D70 38 60 00 00 */ li r3, 0
/* 800EAE14 000E7D74 38 80 00 0C */ li r4, 0xc
/* 800EAE18 000E7D78 48 21 DB C9 */ bl SetTevKColorSel__3CGXF13_GXTevStageID15_GXTevKColorSel
/* 800EAE1C 000E7D7C 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EAE1C 000E7D7C 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EAE20 000E7D80 38 60 00 00 */ li r3, 0
/* 800EAE24 000E7D84 38 80 00 00 */ li r4, 0
/* 800EAE28 000E7D88 38 C0 00 FF */ li r6, 0xff
/* 800EAE2C 000E7D8C 48 21 DB 21 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EAE30 000E7D90 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EAE30 000E7D90 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EAE34 000E7D94 38 60 00 01 */ li r3, 1
/* 800EAE38 000E7D98 38 80 00 01 */ li r4, 1
/* 800EAE3C 000E7D9C 38 C0 00 FF */ li r6, 0xff
/* 800EAE40 000E7DA0 48 21 DB 0D */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EAE44 000E7DA4 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EAE44 000E7DA4 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EAE48 000E7DA8 38 60 00 02 */ li r3, 2
/* 800EAE4C 000E7DAC 38 80 00 02 */ li r4, 2
/* 800EAE50 000E7DB0 38 C0 00 FF */ li r6, 0xff
/* 800EAE54 000E7DB4 48 21 DA F9 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EAE58 000E7DB8 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EAE58 000E7DB8 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EAE5C 000E7DBC 38 60 00 03 */ li r3, 3
/* 800EAE60 000E7DC0 38 80 00 03 */ li r4, 3
/* 800EAE64 000E7DC4 38 C0 00 FF */ li r6, 0xff
/* 800EAE68 000E7DC8 48 21 DA E5 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EAE6C 000E7DCC 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EAE6C 000E7DCC 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EAE70 000E7DD0 38 60 00 04 */ li r3, 4
/* 800EAE74 000E7DD4 38 80 00 04 */ li r4, 4
/* 800EAE78 000E7DD8 38 C0 00 FF */ li r6, 0xff
/* 800EAE7C 000E7DDC 48 21 DA D1 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EAE80 000E7DE0 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EAE80 000E7DE0 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EAE84 000E7DE4 38 60 00 05 */ li r3, 5
/* 800EAE88 000E7DE8 38 80 00 05 */ li r4, 5
/* 800EAE8C 000E7DEC 38 C0 00 FF */ li r6, 0xff
/* 800EAE90 000E7DF0 48 21 DA BD */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EAE94 000E7DF4 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EAE94 000E7DF4 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EAE98 000E7DF8 38 60 00 06 */ li r3, 6
/* 800EAE9C 000E7DFC 38 80 00 06 */ li r4, 6
/* 800EAEA0 000E7E00 38 C0 00 FF */ li r6, 0xff
/* 800EAEA4 000E7E04 48 21 DA A9 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EAEA8 000E7E08 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EAEA8 000E7E08 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EAEAC 000E7E0C 38 60 00 07 */ li r3, 7
/* 800EAEB0 000E7E10 38 80 00 07 */ li r4, 7
/* 800EAEB4 000E7E14 38 C0 00 FF */ li r6, 0xff
@ -939,42 +939,42 @@ lbl_800EB398:
/* 800EB418 000E8378 38 60 00 00 */ li r3, 0
/* 800EB41C 000E837C 38 80 00 1C */ li r4, 0x1c
/* 800EB420 000E8380 48 21 D5 7D */ bl SetTevKAlphaSel__3CGXF13_GXTevStageID15_GXTevKAlphaSel
/* 800EB424 000E8384 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EB424 000E8384 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EB428 000E8388 38 60 00 00 */ li r3, 0
/* 800EB42C 000E838C 38 80 00 00 */ li r4, 0
/* 800EB430 000E8390 38 C0 00 FF */ li r6, 0xff
/* 800EB434 000E8394 48 21 D5 19 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EB438 000E8398 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EB438 000E8398 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EB43C 000E839C 38 60 00 01 */ li r3, 1
/* 800EB440 000E83A0 38 80 00 01 */ li r4, 1
/* 800EB444 000E83A4 38 C0 00 FF */ li r6, 0xff
/* 800EB448 000E83A8 48 21 D5 05 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EB44C 000E83AC 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EB44C 000E83AC 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EB450 000E83B0 38 60 00 02 */ li r3, 2
/* 800EB454 000E83B4 38 80 00 02 */ li r4, 2
/* 800EB458 000E83B8 38 C0 00 FF */ li r6, 0xff
/* 800EB45C 000E83BC 48 21 D4 F1 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EB460 000E83C0 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EB460 000E83C0 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EB464 000E83C4 38 60 00 03 */ li r3, 3
/* 800EB468 000E83C8 38 80 00 03 */ li r4, 3
/* 800EB46C 000E83CC 38 C0 00 FF */ li r6, 0xff
/* 800EB470 000E83D0 48 21 D4 DD */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EB474 000E83D4 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EB474 000E83D4 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EB478 000E83D8 38 60 00 04 */ li r3, 4
/* 800EB47C 000E83DC 38 80 00 04 */ li r4, 4
/* 800EB480 000E83E0 38 C0 00 FF */ li r6, 0xff
/* 800EB484 000E83E4 48 21 D4 C9 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EB488 000E83E8 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EB488 000E83E8 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EB48C 000E83EC 38 60 00 05 */ li r3, 5
/* 800EB490 000E83F0 38 80 00 05 */ li r4, 5
/* 800EB494 000E83F4 38 C0 00 FF */ li r6, 0xff
/* 800EB498 000E83F8 48 21 D4 B5 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EB49C 000E83FC 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EB49C 000E83FC 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EB4A0 000E8400 38 60 00 06 */ li r3, 6
/* 800EB4A4 000E8404 38 80 00 06 */ li r4, 6
/* 800EB4A8 000E8408 38 C0 00 FF */ li r6, 0xff
/* 800EB4AC 000E840C 48 21 D4 A1 */ bl SetTevOrder__3CGXF13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID
/* 800EB4B0 000E8410 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 800EB4B0 000E8410 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800EB4B4 000E8414 38 60 00 07 */ li r3, 7
/* 800EB4B8 000E8418 38 80 00 07 */ li r4, 7
/* 800EB4BC 000E841C 38 C0 00 FF */ li r6, 0xff

View File

@ -611,11 +611,11 @@ SetScreenStretch__12CGameOptionsFib:
/* 8020EF2C 0020BE8C 38 61 00 14 */ addi r3, r1, 0x14
/* 8020EF30 0020BE90 38 81 00 10 */ addi r4, r1, 0x10
/* 8020EF34 0020BE94 38 A1 00 0C */ addi r5, r1, 0xc
/* 8020EF38 0020BE98 48 0F A6 2D */ bl sub_80309564__9CGraphicsFPUiPUiPUi
/* 8020EF38 0020BE98 48 0F A6 2D */ bl GetScreenPosition__9CGraphicsFPiPiPi
/* 8020EF3C 0020BE9C 80 7E 00 54 */ lwz r3, 0x54(r30)
/* 8020EF40 0020BEA0 80 81 00 10 */ lwz r4, 0x10(r1)
/* 8020EF44 0020BEA4 80 A1 00 0C */ lwz r5, 0xc(r1)
/* 8020EF48 0020BEA8 48 0F A5 69 */ bl sub_803094b0__9CGraphicsFUiUiUi
/* 8020EF48 0020BEA8 48 0F A5 69 */ bl SetScreenPosition__9CGraphicsFiii
lbl_8020EF4C:
/* 8020EF4C 0020BEAC 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8020EF50 0020BEB0 83 E1 00 1C */ lwz r31, 0x1c(r1)
@ -645,11 +645,11 @@ SetScreenPositionY__12CGameOptionsFib:
/* 8020EFA4 0020BF04 38 61 00 14 */ addi r3, r1, 0x14
/* 8020EFA8 0020BF08 38 81 00 10 */ addi r4, r1, 0x10
/* 8020EFAC 0020BF0C 38 A1 00 0C */ addi r5, r1, 0xc
/* 8020EFB0 0020BF10 48 0F A5 B5 */ bl sub_80309564__9CGraphicsFPUiPUiPUi
/* 8020EFB0 0020BF10 48 0F A5 B5 */ bl GetScreenPosition__9CGraphicsFPiPiPi
/* 8020EFB4 0020BF14 80 61 00 14 */ lwz r3, 0x14(r1)
/* 8020EFB8 0020BF18 80 81 00 10 */ lwz r4, 0x10(r1)
/* 8020EFBC 0020BF1C 80 BE 00 50 */ lwz r5, 0x50(r30)
/* 8020EFC0 0020BF20 48 0F A4 F1 */ bl sub_803094b0__9CGraphicsFUiUiUi
/* 8020EFC0 0020BF20 48 0F A4 F1 */ bl SetScreenPosition__9CGraphicsFiii
lbl_8020EFC4:
/* 8020EFC4 0020BF24 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8020EFC8 0020BF28 83 E1 00 1C */ lwz r31, 0x1c(r1)
@ -679,11 +679,11 @@ SetScreenPositionX__12CGameOptionsFib:
/* 8020F01C 0020BF7C 38 61 00 14 */ addi r3, r1, 0x14
/* 8020F020 0020BF80 38 81 00 10 */ addi r4, r1, 0x10
/* 8020F024 0020BF84 38 A1 00 0C */ addi r5, r1, 0xc
/* 8020F028 0020BF88 48 0F A5 3D */ bl sub_80309564__9CGraphicsFPUiPUiPUi
/* 8020F028 0020BF88 48 0F A5 3D */ bl GetScreenPosition__9CGraphicsFPiPiPi
/* 8020F02C 0020BF8C 80 61 00 14 */ lwz r3, 0x14(r1)
/* 8020F030 0020BF90 80 9E 00 4C */ lwz r4, 0x4c(r30)
/* 8020F034 0020BF94 80 A1 00 0C */ lwz r5, 0xc(r1)
/* 8020F038 0020BF98 48 0F A4 79 */ bl sub_803094b0__9CGraphicsFUiUiUi
/* 8020F038 0020BF98 48 0F A4 79 */ bl SetScreenPosition__9CGraphicsFiii
lbl_8020F03C:
/* 8020F03C 0020BF9C 80 01 00 24 */ lwz r0, 0x24(r1)
/* 8020F040 0020BFA0 83 E1 00 1C */ lwz r31, 0x1c(r1)

View File

@ -156,7 +156,7 @@ lbl_80295CF0:
/* 80295D0C 00292C6C 7C 00 2B 78 */ or r0, r0, r5
/* 80295D10 00292C70 54 1D 0F FE */ srwi r29, r0, 0x1f
/* 80295D14 00292C74 48 07 88 E1 */ bl GetConstBitMapData__8CTextureCFi
/* 80295D18 00292C78 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 80295D18 00292C78 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 80295D1C 00292C7C 7C 66 1B 78 */ mr r6, r3
/* 80295D20 00292C80 7F 63 DB 78 */ mr r3, r27
/* 80295D24 00292C84 7F 84 E3 78 */ mr r4, r28

View File

@ -9298,7 +9298,7 @@ DrawScreenTex__Ff:
/* 800425AC 0003F50C 38 80 00 06 */ li r4, 6
/* 800425B0 0003F510 38 A0 00 01 */ li r5, 1
/* 800425B4 0003F514 48 2C 94 E1 */ bl SetDepthWriteMode__9CGraphicsFb8ERglEnumb
/* 800425B8 0003F518 80 E2 C7 A8 */ lwz r7, lbl_805AE4C8@sda21(r2)
/* 800425B8 0003F518 80 E2 C7 A8 */ lwz r7, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 800425BC 0003F51C 38 60 01 40 */ li r3, 0x140
/* 800425C0 0003F520 38 80 00 E0 */ li r4, 0xe0
/* 800425C4 0003F524 38 A0 00 06 */ li r5, 6
@ -9326,7 +9326,7 @@ DrawScreenTex__Ff:
/* 8004261C 0003F57C 48 2C 67 F9 */ bl SetNumTexGens__3CGXFUc
/* 80042620 0003F580 38 60 00 01 */ li r3, 1
/* 80042624 0003F584 48 2C 66 6D */ bl SetNumTevStages__3CGXFUc
/* 80042628 0003F588 80 A2 C7 A8 */ lwz r5, lbl_805AE4C8@sda21(r2)
/* 80042628 0003F588 80 A2 C7 A8 */ lwz r5, kSpareBufferTexMapID__9CGraphics@sda21(r2)
/* 8004262C 0003F58C 38 60 00 00 */ li r3, 0
/* 80042630 0003F590 38 80 00 00 */ li r4, 0
/* 80042634 0003F594 38 C0 00 FF */ li r6, 0xff

View File

@ -45,11 +45,16 @@ inline ushort FtoUS(register float in) {
return *ptr;
}
inline int FtoL(float in) { return static_cast< int >(in); }
inline float LtoF(int in) { return static_cast< float >(in); }
#else
inline uchar ToUint8(float in) { return static_cast< uchar >(in); }
inline float ToReal32(uchar in) { return static_cast< float >(in); }
inline short FtoS(float in) { return static_cast< short >(in); }
inline ushort FtoUS(float in) { return static_cast< ushort >(in); }
inline int FtoL(float in) { return static_cast< int >(in); }
inline float LtoF(int in) { return static_cast< float >(in); }
#endif
inline int ToInt32(float in) { return static_cast< int >(in); }

View File

@ -7,8 +7,10 @@
#include "Kyoto/Graphics/CColor.hpp"
#include "Kyoto/Graphics/CLight.hpp"
#include "Kyoto/Graphics/CTevCombiners.hpp"
#include "Kyoto/Graphics/CTexture.hpp"
#include "Kyoto/Math/CMatrix4f.hpp"
#include "Kyoto/Math/CTransform4f.hpp"
#include "Kyoto/Math/CVector2i.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "dolphin/gx.h"
@ -170,7 +172,6 @@ struct CViewport {
class COsContext;
class CTexture;
class CTimeProvider;
class CTexture;
// TODO
typedef struct {
@ -186,7 +187,7 @@ public:
void Flush();
void ResetFlushAll();
void SetVtxState(const float*, const float*, const unsigned int*);
int SetVtxState(const float* pos, const float* nrm, const uint* clr);
// In map this takes two args, but x4 is unused?
void Set(int v0) { x0_ = v0; }
@ -226,6 +227,46 @@ public:
float x18_far;
};
class CClippedScreenRect {
public:
CClippedScreenRect() : x0_valid(false) {}
CClippedScreenRect(int x, int y, int width, int height, int texWidth, float minU, float maxU,
float minV, float maxV)
: x0_valid(true)
, x4_x(x)
, x8_y(y)
, xc_width(width)
, x10_height(height)
, x14_texWidth(texWidth)
, x18_minU(minU)
, x1c_maxU(maxU)
, x20_minV(minV)
, x24_maxV(maxV) {}
bool IsValid() const { return x0_valid; }
int GetX() const { return x4_x; }
int GetY() const { return x8_y; }
int GetWidth() const { return xc_width; }
int GetHeight() const { return x10_height; }
int GetTexWidth() const { return x14_texWidth; }
float GetMinU() const { return x18_minU; }
float GetMaxU() const { return x1c_maxU; }
float GetMinV() const { return x20_minV; }
float GetMaxV() const { return x24_maxV; }
private:
bool x0_valid;
int x4_x;
int x8_y;
int xc_width;
int x10_height;
int x14_texWidth;
float x18_minU;
float x1c_maxU;
float x20_minV;
float x24_maxV;
};
static bool Startup(const COsContext& osContext, uint fifoSize, void* fifoBase);
static GXTexRegion* TexRegionCallback(const GXTexObj* obj, GXTexMapID id);
static void InitGraphicsVariables();
@ -259,6 +300,11 @@ public:
static void TickRenderTimings();
static const CProjectionState& GetProjectionState();
static void SetProjectionState(const CProjectionState& proj);
static CClippedScreenRect ClipScreenRectFromVS(const CVector3f& p1, const CVector3f& p2,
ETexelFormat fmt);
static CClippedScreenRect ClipScreenRectFromMS(const CVector3f& p1, const CVector3f& p2,
ETexelFormat fmt);
static CVector2i ProjectPoint(const CVector3f& point);
static float GetDepthNear() { return mDepthNear; }
static float GetDepthFar() { return mDepthFar; }
@ -296,6 +342,7 @@ public:
static void SetOrtho(float left, float right, float top, float bottom, float znear, float zfar);
static float GetSecondsMod900();
static float GetFPS();
static void SetExternalTimeProvider(CTimeProvider* provider);
static void DisableAllLights();
@ -311,9 +358,17 @@ public:
static void SetCullMode(ERglCullMode cullMode);
static void SetTevStates(uchar);
static void SetUseVideoFilter(bool b);
static GXBool GetUseVideoFilter();
static int GetFrameCounter();
static void SetProgressiveMode(bool b);
static bool GetProgressiveMode();
static bool CanSetProgressiveMode();
static bool GetProgressiveDefault();
// Screen Position
static void sub_80309564(uint* stretch, uint* xOffset, uint* yOffset);
static void sub_803094b0(uint stretch, uint xOffset, uint yOffset);
static void GetScreenPosition(int* stretch, int* xOffset, int* yOffset);
static void SetScreenPosition(int stretch, int xOffset, int yOffset);
static const CTevCombiners::CTevPass& kEnvPassthru;
static CTevCombiners::CTevPass kEnvModulateConstColor;
@ -369,13 +424,9 @@ private:
static uint mRenderTimings;
static float mSecondsMod900;
static CTimeProvider* mpExternalTimeProvider;
// lbl_805A9408
// lbl_805A940C
// lbl_805A9410
// "nextTexRgn$2336"
// "init$2337"
// "nextTexRgnCI$2339"
// "init$2340"
static int mScreenStretch;
static int mScreenPositionX;
static int mScreenPositionY;
static CVector3f kDefaultPositionVector;
static CVector3f kDefaultDirectionVector;
@ -403,11 +454,11 @@ private:
static u32 mClearDepthValue; // = GX_MAX_Z24
static bool mIsGXModelMatrixIdentity;
static bool mFirstFrame;
static bool mUseVideoFilter;
static GXBool mUseVideoFilter;
static float mBrightness;
// static const float mBrightnessMin;
// static const float mBrightnessMax;
static Vec2 mBrightnessRange;
// .sdata2
static const GXTexMapID kSpareBufferTexMapID;
};
#endif // _CGRAPHICS

View File

@ -8,6 +8,8 @@ public:
CMatrix4f(float, float, float, float, float, float, float, float, float, float, float, float,
float, float, float, float);
CVector3f MultiplyOneOverW(const CVector3f& vec) const;
private:
float m00;
float m01;

View File

@ -73,7 +73,9 @@ public:
// ScaleBy__12CTransform4fFf
// SetRotation__12CTransform4fFRC12CTransform4f
// SetRotation__12CTransform4fFRC9CMatrix3f
// TransposeMultiply__12CTransform4fCFRC9CVector3f
CVector3f TransposeMultiply(const CVector3f& in) const {
return TransposeRotate(CVector3f(in.GetX() - posX, in.GetY() - posY, in.GetZ() - posZ));
}
CVector3f TransposeRotate(const CVector3f& in) const;
void SetTranslation(const CVector3f& vec) {

View File

@ -10,6 +10,9 @@ public:
int GetX() const { return mX; }
int GetY() const { return mY; }
int& operator[](int idx) { return *(&mX + idx); }
const int& operator[](int idx) const { return *(&mX + idx); }
private:
int mX;
int mY;

View File

@ -12,6 +12,7 @@ extern "C" {
u32 VIGetNextField(void);
VIRetraceCallback VISetPreRetraceCallback(VIRetraceCallback callback);
VIRetraceCallback VISetPostRetraceCallback(VIRetraceCallback callback);
u32 VIGetDTVStatus(void);
#ifdef __cplusplus
}

View File

@ -45,7 +45,7 @@ typedef unsigned int _UINT32;
int abs(int n);
#ifdef __MWERKS__
// #define abs(n) __abs(n)
#define abs(n) __abs(n)
#define labs(n) __labs(n)
static inline double fabs(double x) { return __fabs(x); }
#else

View File

@ -1,5 +1,6 @@
#include "Kyoto/Graphics/CGraphics.hpp"
#include "Kyoto/Alloc/CMemory.hpp"
#include "Kyoto/Basics/COsContext.hpp"
#include "Kyoto/Basics/CStopwatch.hpp"
#include "Kyoto/CFrameDelayedKiller.hpp"
@ -8,6 +9,8 @@
#include "Kyoto/Graphics/CTexture.hpp"
#include "Kyoto/Math/CRelAngle.hpp"
#include "rstl/math.hpp"
#include "dolphin/vi.h"
#include <string.h>
@ -234,9 +237,9 @@ GXFifoObj* CGraphics::mpFifoObj;
uint CGraphics::mRenderTimings;
float CGraphics::mSecondsMod900;
CTimeProvider* CGraphics::mpExternalTimeProvider;
int lbl_805A9408;
int lbl_805A940C;
int lbl_805A9410;
int CGraphics::mScreenStretch;
int CGraphics::mScreenPositionX;
int CGraphics::mScreenPositionY;
CViewport CGraphics::mViewport = {0, 0, 640, 448, 320.f, 240.f};
ELightType CGraphics::mLightTypes[8] = {
@ -252,9 +255,10 @@ float CGraphics::mDepthFar = 1.f;
u32 CGraphics::mClearDepthValue = GX_MAX_Z24;
bool CGraphics::mIsGXModelMatrixIdentity = true;
bool CGraphics::mFirstFrame = true;
bool CGraphics::mUseVideoFilter = true;
GXBool CGraphics::mUseVideoFilter = GX_ENABLE;
float CGraphics::mBrightness = 1.f;
// Vec2 CGraphics::mBrightnessRange = {0.f, 2.f};
const GXTexMapID CGraphics::kSpareBufferTexMapID = GX_TEXMAP7;
bool CGraphics::Startup(const COsContext& osContext, uint fifoSize, void* fifoBase) {
mpFifo = fifoBase;
@ -1065,7 +1069,7 @@ void CGraphics::FlushStream() {
*curDesc++ = vtxDescPos;
if ((vtxDescr.streamFlags & kHasNormals) != 0) {
const GXVtxDescList vtxDescNrm = {GX_VA_CLR0, GX_DIRECT};
const GXVtxDescList vtxDescNrm = {GX_VA_NRM, GX_DIRECT};
*curDesc++ = vtxDescNrm;
}
@ -1353,3 +1357,229 @@ void CGraphics::SetProjectionState(const CProjectionState& proj) {
mProj = proj;
FlushProjection();
}
// TODO non-matching (regswaps)
CGraphics::CClippedScreenRect
CGraphics::ClipScreenRectFromVS(const CVector3f& p1, const CVector3f& p2, ETexelFormat fmt) {
if (!p1.IsNonZero() || !p2.IsNonZero()) {
return CClippedScreenRect();
}
if (p1.GetY() < GetProjectionState().GetNear() || p2.GetY() < GetProjectionState().GetNear()) {
return CClippedScreenRect();
}
if (p1.GetY() > GetProjectionState().GetFar() || p2.GetY() > GetProjectionState().GetFar()) {
return CClippedScreenRect();
}
CVector2i p1p = ProjectPoint(p1);
CVector2i p2p = ProjectPoint(p2);
int minX = rstl::min_val(p1p.GetX(), p2p.GetX());
int minY = rstl::min_val(p1p.GetY(), p2p.GetY());
int maxX = abs(p1p.GetX() - p2p.GetX());
int maxY = abs(p1p.GetY() - p2p.GetY());
int left = minX & 0xfffffffe;
if (left >= mViewport.mLeft + mViewport.mWidth) {
return CClippedScreenRect();
}
int right = minX + maxX + 2 & 0xfffffffe;
if (right <= mViewport.mLeft) {
return CClippedScreenRect();
}
left = rstl::max_val(left, mViewport.mLeft) & 0xfffffffe;
right = rstl::min_val(right, mViewport.mLeft + mViewport.mWidth) + 1 & 0xfffffffe;
int top = minY & 0xfffffffe;
if (top >= mViewport.mTop + mViewport.mHeight) {
return CClippedScreenRect();
}
int bottom = minY + maxY + 2 & 0xfffffffe;
if (bottom <= mViewport.mTop) {
return CClippedScreenRect();
}
top = rstl::max_val(top, mViewport.mTop) & 0xfffffffe;
bottom = rstl::min_val(bottom, mViewport.mTop + mViewport.mHeight) + 1 & 0xfffffffe;
// int height = bottom - top;
float minV = static_cast< float >(minY - top) / static_cast< float >(bottom - top);
float maxV = static_cast< float >(maxY + (minY - top) + 1) / static_cast< float >(bottom - top);
int texAlign = 4;
switch (fmt) {
case kTF_I8:
texAlign = 8;
break;
case kTF_IA8:
case kTF_RGB565:
case kTF_RGB5A3:
texAlign = 4;
break;
case kTF_RGBA8:
texAlign = 2;
break;
}
// int width = right - left;
int texWidth = texAlign + (right - left) - 1 & ~(texAlign - 1);
float minU = static_cast< float >(minX - left) / static_cast< float >(texWidth);
float maxU = static_cast< float >(maxX + (minX - left) + 1) / static_cast< float >(texWidth);
return CClippedScreenRect(left, top, right - left, bottom - top, texWidth, minU, maxU, minV,
maxV);
}
CGraphics::CClippedScreenRect
CGraphics::ClipScreenRectFromMS(const CVector3f& p1, const CVector3f& p2, ETexelFormat fmt) {
return ClipScreenRectFromVS(mViewMatrix.TransposeMultiply(mModelMatrix * p1),
mViewMatrix.TransposeMultiply(mModelMatrix * p2), fmt);
}
float CGraphics::GetFPS() {
BOOL level = OSDisableInterrupts();
float value = rstl::min_val(mFramesPerSecond, mLastFramesPerSecond);
OSRestoreInterrupts(level);
return value;
}
void CGraphics::SetUseVideoFilter(bool b) {
mUseVideoFilter = b;
GXSetCopyFilter(mRenderModeObj.aa, mRenderModeObj.sample_pattern, b ? GX_ENABLE : GX_DISABLE,
mRenderModeObj.vfilter);
}
GXBool CGraphics::GetUseVideoFilter() { return mUseVideoFilter; }
int CGraphics::GetFrameCounter() { return mFrameCounter; }
CVector2i CGraphics::ProjectPoint(const CVector3f& point) {
CVector3f vec = GetPerspectiveProjectionMatrix().MultiplyOneOverW(point);
vec.SetX(vec.GetX() * GetViewport().mHalfWidth + GetViewport().mHalfWidth);
vec.SetY(-vec.GetY() * GetViewport().mHalfHeight + GetViewport().mHalfHeight);
return CVector2i(CCast::FtoL(vec.GetX()), CCast::FtoL(vec.GetY()));
}
void CGraphics::SetProgressiveMode(bool b) {
bool isProgressive = GetProgressiveMode();
OSSetProgressiveMode(b ? OS_PROGRESSIVE_MODE_ON : OS_PROGRESSIVE_MODE_OFF);
if (b == isProgressive) {
return;
}
VISetBlack(TRUE);
VIFlush();
VIWaitForRetrace();
for (int i = 0; i < 10; ++i) {
VIWaitForRetrace();
}
if (b) {
mRenderModeObj.viTVmode = VI_TVMODE_NTSC_PROG;
mRenderModeObj.xFBmode = VI_XFBMODE_SF;
const u8 vfilter[7] = {0x04, 0x04, 0x10, 0x10, 0x10, 0x04, 0x04};
memcpy(mRenderModeObj.vfilter, vfilter, 7);
} else {
mRenderModeObj.viTVmode = VI_TVMODE_NTSC_INT;
mRenderModeObj.xFBmode = VI_XFBMODE_DF;
memcpy(mRenderModeObj.vfilter, GXNtsc480IntDf.vfilter, 7);
}
GXSetCopyFilter(mRenderModeObj.aa, mRenderModeObj.sample_pattern, GX_ENABLE,
mRenderModeObj.vfilter);
VIConfigure(&mRenderModeObj);
VISetBlack(TRUE);
VIFlush();
for (int i = 0; i < 100; ++i) {
VIWaitForRetrace();
}
VISetBlack(FALSE);
VIFlush();
for (int i = 0; i < 2; ++i) {
VIWaitForRetrace();
}
}
bool CGraphics::GetProgressiveMode() { return mRenderModeObj.viTVmode == VI_TVMODE_NTSC_PROG; }
bool CGraphics::CanSetProgressiveMode() { return VIGetDTVStatus() != 0; }
bool CGraphics::GetProgressiveDefault() { return OSGetProgressiveMode() == OS_PROGRESSIVE_MODE_ON; }
void CGraphics::GetScreenPosition(int* stretch, int* xOffset, int* yOffset) {
if (stretch != nullptr) {
*stretch = mScreenStretch;
}
if (xOffset != nullptr) {
*xOffset = mScreenPositionX;
}
if (yOffset != nullptr) {
*yOffset = mScreenPositionY;
}
}
void CGraphics::SetScreenPosition(int stretch, int xOffset, int yOffset) {
int stretchChange = stretch - mScreenStretch;
int xChange = xOffset - mScreenPositionX;
int yChange = yOffset - mScreenPositionY;
if (stretchChange == 0 && xChange == 0 && yChange == 0) {
return;
}
mRenderModeObj.viWidth += stretchChange * 2;
mRenderModeObj.viXOrigin += xChange - stretchChange;
mRenderModeObj.viYOrigin += yChange;
VIConfigure(&mRenderModeObj);
VIFlush();
mScreenStretch = stretch;
mScreenPositionX = xOffset;
mScreenPositionY = yOffset;
}
void CGraphics::SetIsBeginSceneClearFb(bool b) { mIsBeginSceneClearFb = b; }
CGraphicsSys::CGraphicsSys(const COsContext& osContext, const CMemorySys& memorySys, uint fifoSize,
void* fifoBase) {
if (mGraphicsInitialized != true) {
mGraphicsInitialized = CGraphics::Startup(osContext, fifoSize, fifoBase);
}
}
CGraphicsSys::~CGraphicsSys() {
if (mGraphicsInitialized == true) {
CGraphics::Shutdown();
mGraphicsInitialized = false;
}
}
CGraphics::CRenderState::CRenderState() {
x0_ = 0;
x4_ = 0;
}
void CGraphics::CRenderState::Flush() {}
int CGraphics::CRenderState::SetVtxState(const float* pos, const float* nrm, const uint* clr) {
CGX::SetArray(GX_VA_POS, pos, 12);
CGX::SetArray(GX_VA_NRM, nrm, 12);
CGX::SetArray(GX_VA_CLR0, clr, 4);
int result = 1;
if (nrm != nullptr) {
result |= 2;
}
if (clr != nullptr) {
result |= 16;
}
return result;
}
void CGraphics::CRenderState::ResetFlushAll() {
x0_ = 0;
SetVtxState(nullptr, nullptr, nullptr);
for (int i = 0; i < 8; i++) {
CGX::SetArray(static_cast< GXAttr >(GX_VA_TEX0 + i), nullptr, 8);
}
Flush();
}
// static float stripped(int n) { return static_cast<float>(n); }

View File

@ -175,18 +175,18 @@ float CGameOptions::TuneScreenBrightness() {
void CGameOptions::SetScreenPositionX(int position, bool apply) {
x4c_screenXOffset = CMath::Clamp(-30, position, 30);
if (apply) {
uint a, b, c;
CGraphics::sub_80309564(&a, &b, &c);
CGraphics::sub_803094b0(a, x4c_screenXOffset, c);
int a, b, c;
CGraphics::GetScreenPosition(&a, &b, &c);
CGraphics::SetScreenPosition(a, x4c_screenXOffset, c);
}
}
void CGameOptions::SetScreenPositionY(int position, bool apply) {
x50_screenYOffset = CMath::Clamp(-30, position, 30);
if (apply) {
uint a, b, c;
CGraphics::sub_80309564(&a, &b, &c);
CGraphics::sub_803094b0(a, b, x50_screenYOffset);
int a, b, c;
CGraphics::GetScreenPosition(&a, &b, &c);
CGraphics::SetScreenPosition(a, b, x50_screenYOffset);
}
}
@ -194,9 +194,9 @@ void CGameOptions::SetScreenStretch(int value, bool apply) {
x54_screenStretch = CMath::Clamp(-10, value, 10);
if (apply) {
uint a, b, c;
CGraphics::sub_80309564(&a, &b, &c);
CGraphics::sub_803094b0(x54_screenStretch, b, c);
int a, b, c;
CGraphics::GetScreenPosition(&a, &b, &c);
CGraphics::SetScreenPosition(x54_screenStretch, b, c);
}
}