J2DPicture

This commit is contained in:
LagoLunatic 2024-09-08 16:29:54 -04:00 committed by Hunter Shelton
parent 891d89f13e
commit d6f073f3c3
3 changed files with 9 additions and 412 deletions

View File

@ -426,7 +426,7 @@ config.libs = [
Object(Matching, "JSystem/J2D/J2DPerspGraph.cpp"),
Object(Matching, "JSystem/J2D/J2DGrafContext.cpp"),
Object(Matching, "JSystem/J2D/J2DPane.cpp"),
Object(NonMatching, "JSystem/J2D/J2DPicture.cpp"),
Object(Matching, "JSystem/J2D/J2DPicture.cpp"),
Object(Matching, "JSystem/J2D/J2DPrint.cpp"),
Object(NonMatching, "JSystem/J2D/J2DScreen.cpp"),
Object(Matching, "JSystem/J2D/J2DTextBox.cpp"),

View File

@ -7,7 +7,7 @@
// Size: 0x168
struct J2DPicture : public J2DPane {
struct TCornerColor {
TCornerColor() { }
TCornerColor() {}
TCornerColor(u32 col1, u32 col2, u32 col3, u32 col4)
{
@ -43,9 +43,6 @@ struct J2DPicture : public J2DPane {
virtual u16 getTypeID() const { return PANETYPE_Picture; }; // _0C (weak)
virtual void drawSelf(f32 x, f32 y); // _34
virtual void drawSelf(f32 x, f32 y, Mtx* texMtx); // _38
virtual bool isUsed(const ResTIMG* resource); // _4C
virtual bool isUsed(const ResFONT* resource) { return J2DPane::isUsed(resource); } // _50 (weak)
virtual void rewriteAlpha() { } // _58 (weak)
virtual void initiate(const ResTIMG* img, const ResTLUT* lut); // _94
virtual bool prepareTexture(u8); // _98
virtual bool append(const ResTIMG* resource, f32 blendRatio) { return insert(resource, mTextureCount, blendRatio); } // _9C (weak)
@ -143,6 +140,9 @@ struct J2DPicture : public J2DPane {
virtual void drawTexCoord(f32 x, f32 y, f32 width, f32 height, s16 btmLeftS, s16 btmLeftT, s16 btmRightS, s16 btmRightT, s16 topLeftS,
s16 topLeftT, s16 topRightS, s16 topRightT, Mtx* texMtx); // _144
virtual u8 getUsableTlut(u8 id); // _148
virtual bool isUsed(const ResTIMG* resource); // _4C
virtual bool isUsed(const ResFONT* resource) { return J2DPane::isUsed(resource); } // _50 (weak)
virtual void rewriteAlpha() {} // _58 (weak)
void initinfo();
void private_readStream(J2DPane* parent, JSURandomInputStream* input, JKRArchive* arc);

View File

@ -74,8 +74,10 @@ J2DPicture::J2DPicture(J2DPane* parent, JSURandomInputStream* input, J2DMaterial
u8 texGenNum = material->getTexGenBlock()->getTexGenNum();
u8 tevStageNum = material->getTevBlock()->getTevStageNum();
if ((texGenNum == 1 && tevStageNum != 1) || (texGenNum != 1 && tevStageNum != texGenNum + 1)) {
J2DGXColorS10 black = *material->getTevBlock()->getTevColor(0);
J2DGXColorS10 white = *material->getTevBlock()->getTevColor(1);
J2DGXColorS10 black;
J2DGXColorS10 white;
black = *material->getTevBlock()->getTevColor(0);
white = *material->getTevBlock()->getTevColor(1);
mBlack = JUtility::TColor(RGBA_TO_U32(black.r, black.g, black.b, black.a));
mWhite = JUtility::TColor(RGBA_TO_U32(white.r, white.g, white.b, white.a));
@ -105,411 +107,6 @@ J2DPicture::J2DPicture(J2DPane* parent, JSURandomInputStream* input, J2DMaterial
}
setBlendColorRatio(v2.a, v2.b, v2.g, v2.r, 1.0f, 1.0f, 1.0f, 1.0f);
setBlendAlphaRatio(v3.a, v3.b, v3.g, v3.r, 1.0f, 1.0f, 1.0f, 1.0f);
/*
stwu r1, -0xd0(r1)
mflr r0
stw r0, 0xd4(r1)
stmw r25, 0xb4(r1)
mr r31, r3
mr r25, r4
mr r27, r5
mr r28, r6
bl __ct__7J2DPaneFv
lis r3, __vt__10J2DPicture@ha
lis r4, "__ct__Q29JGeometry8TVec2<s>Fv"@ha
addi r0, r3, __vt__10J2DPicture@l
li r5, 0
stw r0, 0(r31)
addi r3, r31, 0x112
addi r4, r4, "__ct__Q29JGeometry8TVec2<s>Fv"@l
li r6, 4
li r7, 4
bl __construct_array
li r0, 0
lis r3, __ct__Q28JUtility6TColorFv@ha
stw r0, 0x144(r31)
li r0, -1
addi r4, r3, __ct__Q28JUtility6TColorFv@l
addi r3, r31, 0x150
stw r0, 0x148(r31)
li r5, 0
li r6, 4
li r7, 4
stw r0, 0x14c(r31)
bl __construct_array
li r0, -1
mr r3, r27
stw r0, 0x160(r31)
stw r0, 0x164(r31)
lwz r12, 0(r27)
lwz r12, 0x1c(r12)
mtctr r12
bctrl
mr r30, r3
mr r3, r27
addi r4, r1, 0x2c
li r5, 8
bl read__14JSUInputStreamFPvl
lis r4, 0x50494331@ha
mr r3, r27
addi r0, r4, 0x50494331@l
stw r0, 8(r31)
lwz r12, 0(r27)
lwz r12, 0x1c(r12)
mtctr r12
bctrl
mr r29, r3
mr r3, r27
addi r4, r1, 0x24
li r5, 8
bl peek__20JSURandomInputStreamFPvl
mr r3, r31
mr r4, r25
mr r5, r27
bl makePaneExStream__7J2DPaneFP7J2DPaneP20JSURandomInputStream
lwz r0, 0x28(r1)
mr r3, r27
li r5, 0
add r4, r29, r0
bl seek__20JSURandomInputStreamFl17JSUStreamSeekFrom
lis r4, "__ct__Q29JGeometry8TVec2<s>Fv"@ha
addi r3, r1, 0x44
addi r4, r4, "__ct__Q29JGeometry8TVec2<s>Fv"@l
li r5, 0
li r6, 4
li r7, 4
bl __construct_array
mr r3, r27
addi r4, r1, 0x34
li r5, 0x30
bl read__14JSUInputStreamFPvl
li r0, 2
addi r10, r1, 0x34
lhz r29, 0x38(r1)
li r11, 0
mtctr r0
lbl_80039DB8:
lha r3, 0x10(r10)
addi r9, r11, 0x112
addi r8, r11, 0x114
addi r7, r11, 0x150
sthx r3, r31, r9
addi r6, r11, 0x151
addi r4, r11, 0x152
addi r0, r11, 0x153
lha r3, 0x12(r10)
addi r9, r11, 0x116
sthx r3, r31, r8
addi r8, r11, 0x118
lwz r3, 0x20(r10)
stw r3, 0x18(r1)
lbz r5, 0x18(r1)
lbz r3, 0x19(r1)
stbx r5, r31, r7
addi r7, r11, 0x154
lbz r5, 0x1a(r1)
stbx r3, r31, r6
addi r6, r11, 0x155
lbz r3, 0x1b(r1)
stbx r5, r31, r4
addi r4, r11, 0x156
stbx r3, r31, r0
addi r0, r11, 0x157
addi r11, r11, 8
lha r3, 0x14(r10)
sthx r3, r31, r9
lha r3, 0x16(r10)
sthx r3, r31, r8
lwz r3, 0x24(r10)
addi r10, r10, 8
stw r3, 0x18(r1)
lbz r5, 0x18(r1)
lbz r3, 0x19(r1)
stbx r5, r31, r7
lbz r5, 0x1a(r1)
stbx r3, r31, r6
lbz r3, 0x1b(r1)
stbx r5, r31, r4
stbx r3, r31, r0
bdnz lbl_80039DB8
lwz r0, 0x30(r1)
mr r3, r27
li r5, 0
add r4, r30, r0
bl seek__20JSURandomInputStreamFl17JSUStreamSeekFrom
cmplwi r29, 0xffff
li r30, 0
beq lbl_80039E8C
mulli r0, r29, 0x88
add r30, r28, r0
lbl_80039E8C:
li r0, 0xff
cmplwi r30, 0
stb r0, 0xb2(r31)
beq lbl_80039EA4
lbz r0, 0x13(r30)
stb r0, 0xb2(r31)
lbl_80039EA4:
li r4, 0
li r0, -1
stw r4, 0x14(r1)
cmplwi r30, 0
lbz r3, 0x14(r1)
stw r0, 0x10(r1)
lbz r0, 0x15(r1)
stb r3, 0x14c(r31)
lbz r3, 0x16(r1)
stb r0, 0x14d(r31)
lbz r0, 0x17(r1)
stb r3, 0x14e(r31)
lbz r3, 0x10(r1)
stb r0, 0x14f(r31)
lbz r0, 0x11(r1)
stb r3, 0x148(r31)
lbz r3, 0x12(r1)
stb r0, 0x149(r31)
lbz r0, 0x13(r1)
stb r3, 0x14a(r31)
stb r0, 0x14b(r31)
stb r4, 0x110(r31)
beq lbl_8003A01C
lwz r3, 0x70(r30)
cmplwi r3, 0
beq lbl_8003A01C
lwz r12, 0(r3)
lwz r0, 0x28(r30)
lwz r12, 0x58(r12)
clrlwi r29, r0, 0x18
mtctr r12
bctrl
cmplwi r29, 1
bne lbl_80039F38
clrlwi r0, r3, 0x18
cmplwi r0, 1
bne lbl_80039F50
lbl_80039F38:
cmplwi r29, 1
beq lbl_8003A008
clrlwi r3, r3, 0x18
addi r0, r29, 1
cmpw r3, r0
beq lbl_8003A008
lbl_80039F50:
lwz r3, 0x70(r30)
li r4, 0
lwz r12, 0(r3)
lwz r12, 0x38(r12)
mtctr r12
bctrl
lha r27, 0(r3)
li r4, 1
lha r28, 2(r3)
lha r26, 4(r3)
lha r25, 6(r3)
lwz r3, 0x70(r30)
lwz r12, 0(r3)
lwz r12, 0x38(r12)
mtctr r12
bctrl
rlwinm r4, r28, 0x10, 8, 0xf
lha r0, 2(r3)
rlwimi r4, r27, 0x18, 0, 7
lha r5, 0(r3)
rlwimi r4, r26, 8, 0x10, 0x17
rlwinm r0, r0, 0x10, 8, 0xf
rlwimi r4, r25, 0, 0x18, 0x1f
lha r6, 4(r3)
stw r4, 0xc(r1)
rlwimi r0, r5, 0x18, 0, 7
lha r7, 6(r3)
rlwimi r0, r6, 8, 0x10, 0x17
lbz r3, 0xc(r1)
lbz r5, 0xd(r1)
rlwimi r0, r7, 0, 0x18, 0x1f
stb r3, 0x14c(r31)
lbz r4, 0xe(r1)
stb r5, 0x14d(r31)
lbz r3, 0xf(r1)
stw r0, 8(r1)
stb r4, 0x14e(r31)
lbz r0, 8(r1)
stb r3, 0x14f(r31)
lbz r4, 9(r1)
stb r0, 0x148(r31)
lbz r3, 0xa(r1)
stb r4, 0x149(r31)
lbz r0, 0xb(r1)
stb r3, 0x14a(r31)
stb r0, 0x14b(r31)
lbl_8003A008:
cmplwi r29, 4
li r0, 4
bgt lbl_8003A018
mr r0, r29
lbl_8003A018:
stb r0, 0x110(r31)
lbl_8003A01C:
li r25, 0
li r26, 0
stb r25, 0x111(r31)
lbl_8003A028:
cmplwi r30, 0
addi r0, r25, 0x100
li r3, 0
stwx r3, r31, r0
beq lbl_8003A080
lwz r3, 0x70(r30)
cmplwi r3, 0
beq lbl_8003A080
lwz r12, 0(r3)
mr r4, r26
lwz r12, 0xa0(r12)
mtctr r12
bctrl
cmplwi r3, 0
beq lbl_8003A080
addi r4, r25, 0x100
li r0, 1
stwx r3, r31, r4
slw r0, r0, r26
lbz r3, 0x111(r31)
or r0, r3, r0
stb r0, 0x111(r31)
lbl_8003A080:
addi r26, r26, 1
addi r25, r25, 4
cmplwi r26, 4
blt lbl_8003A028
cmplwi r30, 0
beq lbl_8003A0B8
lwz r3, 0x70(r30)
cmplwi r3, 0
beq lbl_8003A0B8
lwz r12, 0(r3)
li r4, 0xf0
lwz r12, 0xb0(r12)
mtctr r12
bctrl
lbl_8003A0B8:
li r0, -1
li r3, 0
cmplwi r30, 0
stw r3, 0x144(r31)
stw r0, 0x20(r1)
stw r0, 0x1c(r1)
beq lbl_8003A14C
lwz r3, 0x70(r30)
cmplwi r3, 0
beq lbl_8003A14C
lwz r12, 0(r3)
li r4, 3
lwz r12, 0x40(r12)
mtctr r12
bctrl
lbz r7, 0(r3)
li r4, 1
lbz r6, 1(r3)
lbz r5, 2(r3)
lbz r0, 3(r3)
lwz r3, 0x70(r30)
stb r7, 0x20(r1)
lwz r12, 0(r3)
stb r6, 0x21(r1)
lwz r12, 0x40(r12)
stb r5, 0x22(r1)
stb r0, 0x23(r1)
mtctr r12
bctrl
lbz r6, 0(r3)
lbz r5, 1(r3)
lbz r4, 2(r3)
lbz r0, 3(r3)
stb r6, 0x1c(r1)
stb r5, 0x1d(r1)
stb r4, 0x1e(r1)
stb r0, 0x1f(r1)
lbl_8003A14C:
lbz r7, 0x23(r1)
lis r6, 0x4330
lbz r5, 0x22(r1)
mr r3, r31
lbz r4, 0x21(r1)
lbz r0, 0x20(r1)
lfs f5, lbl_805167F0@sda21(r2)
lwz r12, 0(r31)
stw r7, 0x6c(r1)
fmr f6, f5
lfd f4, lbl_805167F8@sda21(r2)
fmr f7, f5
stw r6, 0x68(r1)
fmr f8, f5
lwz r12, 0x108(r12)
lfd f0, 0x68(r1)
stw r5, 0x74(r1)
fsubs f1, f0, f4
stw r6, 0x70(r1)
lfd f0, 0x70(r1)
stw r4, 0x7c(r1)
fsubs f2, f0, f4
stw r6, 0x78(r1)
lfd f0, 0x78(r1)
stw r0, 0x84(r1)
fsubs f3, f0, f4
stw r6, 0x80(r1)
lfd f0, 0x80(r1)
fsubs f4, f0, f4
mtctr r12
bctrl
lbz r7, 0x1f(r1)
lis r6, 0x4330
lbz r5, 0x1e(r1)
mr r3, r31
lbz r4, 0x1d(r1)
lbz r0, 0x1c(r1)
lfs f5, lbl_805167F0@sda21(r2)
lwz r12, 0(r31)
stw r7, 0x8c(r1)
fmr f6, f5
lfd f4, lbl_805167F8@sda21(r2)
fmr f7, f5
stw r6, 0x88(r1)
fmr f8, f5
lwz r12, 0x10c(r12)
lfd f0, 0x88(r1)
stw r5, 0x94(r1)
fsubs f1, f0, f4
stw r6, 0x90(r1)
lfd f0, 0x90(r1)
stw r4, 0x9c(r1)
fsubs f2, f0, f4
stw r6, 0x98(r1)
lfd f0, 0x98(r1)
stw r0, 0xa4(r1)
fsubs f3, f0, f4
stw r6, 0xa0(r1)
lfd f0, 0xa0(r1)
fsubs f4, f0, f4
mtctr r12
bctrl
mr r3, r31
lmw r25, 0xb4(r1)
lwz r0, 0xd4(r1)
mtlr r0
addi r1, r1, 0xd0
blr
*/
}
/**