diff --git a/asm/GuiSys/CAuiEnergyBarT01.s b/asm/GuiSys/CAuiEnergyBarT01.s index 05bf1abe..c10d7dbc 100644 --- a/asm/GuiSys/CAuiEnergyBarT01.s +++ b/asm/GuiSys/CAuiEnergyBarT01.s @@ -709,7 +709,7 @@ __ct__16CAuiEnergyBarT01FRCQ210CGuiWidget15CGuiWidgetParmsUi: /* 802CBB0C 002C8A6C D0 3F 00 F8 */ stfs f1, 0xf8(r31) /* 802CBB10 002C8A70 D0 3F 00 FC */ stfs f1, 0xfc(r31) /* 802CBB14 002C8A74 D0 3F 01 00 */ stfs f1, 0x100(r31) -/* 802CBB18 002C8A78 80 6D A6 40 */ lwz r3, lbl_805A9200@sda21(r13) +/* 802CBB18 002C8A78 80 6D A6 40 */ lwz r3, spGuiSys__7CGuiSys@sda21(r13) /* 802CBB1C 002C8A7C 80 03 00 08 */ lwz r0, 8(r3) /* 802CBB20 002C8A80 2C 00 00 02 */ cmpwi r0, 2 /* 802CBB24 002C8A84 41 82 00 B4 */ beq lbl_802CBBD8 @@ -889,4 +889,3 @@ lbl_803D69B0: .asciz "(??)" .balign 4 .4byte 0 - diff --git a/asm/GuiSys/CGuiGroup.s b/asm/GuiSys/CGuiGroup.s index 3a4cf0c5..6c6febc5 100644 --- a/asm/GuiSys/CGuiGroup.s +++ b/asm/GuiSys/CGuiGroup.s @@ -810,8 +810,8 @@ __ct__18CGuiCompoundWidgetFRCQ210CGuiWidget15CGuiWidgetParms: /* 802C1BC4 002BEB24 38 21 00 10 */ addi r1, r1, 0x10 /* 802C1BC8 002BEB28 4E 80 00 20 */ blr -.global FGuiWidgetFactoryInGame__FUiP9CGuiFrameR12CInputStreamb -FGuiWidgetFactoryInGame__FUiP9CGuiFrameR12CInputStreamb: +.global FGuiWidgetFactoryInGame__FUiP9CGuiFrameR12CInputStream +FGuiWidgetFactoryInGame__FUiP9CGuiFrameR12CInputStream: /* 802C1BCC 002BEB2C 94 21 FF F0 */ stwu r1, -0x10(r1) /* 802C1BD0 002BEB30 7C 08 02 A6 */ mflr r0 /* 802C1BD4 002BEB34 3C E0 4C 49 */ lis r7, 0x4C495445@ha @@ -986,7 +986,7 @@ RGuiFrameFactoryInGame__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer: /* 802C1E1C 002BED7C 80 C1 00 08 */ lwz r6, 8(r1) /* 802C1E20 002BED80 80 64 00 04 */ lwz r3, 4(r4) /* 802C1E24 002BED84 80 C6 00 00 */ lwz r6, 0(r6) -/* 802C1E28 002BED88 80 8D A6 40 */ lwz r4, lbl_805A9200@sda21(r13) +/* 802C1E28 002BED88 80 8D A6 40 */ lwz r4, spGuiSys__7CGuiSys@sda21(r13) /* 802C1E2C 002BED8C 80 C6 00 04 */ lwz r6, 4(r6) /* 802C1E30 002BED90 48 00 0B 8D */ bl CreateFrame__9CGuiFrameFUiR7CGuiSysR12CInputStreami /* 802C1E34 002BED94 7C 03 00 D0 */ neg r0, r3 diff --git a/asm/GuiSys/CGuiModel.s b/asm/GuiSys/CGuiModel.s index 945c1c24..d767d4cb 100644 --- a/asm/GuiSys/CGuiModel.s +++ b/asm/GuiSys/CGuiModel.s @@ -449,7 +449,7 @@ __ct__9CGuiModelFRCQ210CGuiWidget15CGuiWidgetParmsUiUib: /* 802C453C 002C149C 98 7F 00 C4 */ stb r3, 0xc4(r31) /* 802C4540 002C14A0 93 9F 00 C8 */ stw r28, 0xc8(r31) /* 802C4544 002C14A4 93 BF 00 CC */ stw r29, 0xcc(r31) -/* 802C4548 002C14A8 80 8D A6 40 */ lwz r4, lbl_805A9200@sda21(r13) +/* 802C4548 002C14A8 80 8D A6 40 */ lwz r4, spGuiSys__7CGuiSys@sda21(r13) /* 802C454C 002C14AC 41 82 00 CC */ beq lbl_802C4618 /* 802C4550 002C14B0 80 7F 00 C8 */ lwz r3, 0xc8(r31) /* 802C4554 002C14B4 3C 03 00 01 */ addis r0, r3, 1 @@ -604,4 +604,3 @@ lbl_803D68B0: # ROM: 0x3D38B0 .asciz "??(??)" .balign 4 - diff --git a/asm/GuiSys/CGuiSys.s b/asm/GuiSys/CGuiSys.s index a9485e46..133da047 100644 --- a/asm/GuiSys/CGuiSys.s +++ b/asm/GuiSys/CGuiSys.s @@ -3,14 +3,14 @@ .section .sbss, "wa" .balign 8 -.global lbl_805A9200 -lbl_805A9200: +.global spGuiSys__7CGuiSys +spGuiSys__7CGuiSys: .skip 0x8 .section .text, "ax" -.global nullsub_7 -nullsub_7: +.global AddFactories__7CGuiSysFQ27CGuiSys10EUsageMode +AddFactories__7CGuiSysFQ27CGuiSys10EUsageMode: /* 802C63E0 002C3340 4E 80 00 20 */ blr .global CreateWidgetInGame__7CGuiSysFUiR12CInputStreamP9CGuiFrame @@ -21,7 +21,7 @@ CreateWidgetInGame__7CGuiSysFUiR12CInputStreamP9CGuiFrame: /* 802C63F0 002C3350 7C 80 23 78 */ mr r0, r4 /* 802C63F4 002C3354 7C A4 2B 78 */ mr r4, r5 /* 802C63F8 002C3358 7C 05 03 78 */ mr r5, r0 -/* 802C63FC 002C335C 4B FF B7 D1 */ bl FGuiWidgetFactoryInGame__FUiP9CGuiFrameR12CInputStreamb +/* 802C63FC 002C335C 4B FF B7 D1 */ bl FGuiWidgetFactoryInGame__FUiP9CGuiFrameR12CInputStream /* 802C6400 002C3360 80 01 00 14 */ lwz r0, 0x14(r1) /* 802C6404 002C3364 7C 08 03 A6 */ mtlr r0 /* 802C6408 002C3368 38 21 00 10 */ addi r1, r1, 0x10 @@ -44,7 +44,7 @@ __dt__7CGuiSysFv: lbl_802C6440: /* 802C6440 002C33A0 38 7E 00 0C */ addi r3, r30, 0xc /* 802C6444 002C33A4 38 80 FF FF */ li r4, -1 -/* 802C6448 002C33A8 48 00 00 31 */ bl sub_802c6478 +/* 802C6448 002C33A8 48 00 00 31 */ bl "__dt__Q24rstl32single_ptr<18CTextExecuteBuffer>Fv" /* 802C644C 002C33AC 7F E0 07 35 */ extsh. r0, r31 /* 802C6450 002C33B0 40 81 00 0C */ ble lbl_802C645C /* 802C6454 002C33B4 7F C3 F3 78 */ mr r3, r30 @@ -58,8 +58,8 @@ lbl_802C645C: /* 802C6470 002C33D0 38 21 00 10 */ addi r1, r1, 0x10 /* 802C6474 002C33D4 4E 80 00 20 */ blr -.global sub_802c6478 -sub_802c6478: +.global "__dt__Q24rstl32single_ptr<18CTextExecuteBuffer>Fv" +"__dt__Q24rstl32single_ptr<18CTextExecuteBuffer>Fv": /* 802C6478 002C33D8 94 21 FF F0 */ stwu r1, -0x10(r1) /* 802C647C 002C33DC 7C 08 02 A6 */ mflr r0 /* 802C6480 002C33E0 90 01 00 14 */ stw r0, 0x14(r1) @@ -101,7 +101,7 @@ __ct__7CGuiSysFP8IFactoryP11CSimplePoolQ27CGuiSys10EUsageMode: /* 802C6500 002C3460 90 03 00 0C */ stw r0, 0xc(r3) /* 802C6504 002C3464 90 03 00 10 */ stw r0, 0x10(r3) /* 802C6508 002C3468 80 83 00 08 */ lwz r4, 8(r3) -/* 802C650C 002C346C 4B FF FE D5 */ bl nullsub_7 +/* 802C650C 002C346C 4B FF FE D5 */ bl AddFactories__7CGuiSysFQ27CGuiSys10EUsageMode /* 802C6510 002C3470 3C 80 80 3D */ lis r4, lbl_803D68C8@ha /* 802C6514 002C3474 38 60 00 DC */ li r3, 0xdc /* 802C6518 002C3478 38 84 68 C8 */ addi r4, r4, lbl_803D68C8@l @@ -113,7 +113,7 @@ __ct__7CGuiSysFP8IFactoryP11CSimplePoolQ27CGuiSys10EUsageMode: /* 802C6530 002C3490 7C 64 1B 78 */ mr r4, r3 lbl_802C6534: /* 802C6534 002C3494 38 7D 00 0C */ addi r3, r29, 0xc -/* 802C6538 002C3498 48 00 00 69 */ bl sub_802c65a0 +/* 802C6538 002C3498 48 00 00 69 */ bl "__as__Q24rstl32single_ptr<18CTextExecuteBuffer>FP18CTextExecuteBuffer" /* 802C653C 002C349C 3C 80 80 3D */ lis r4, lbl_803D68C8@ha /* 802C6540 002C34A0 38 60 00 04 */ li r3, 4 /* 802C6544 002C34A4 38 84 68 C8 */ addi r4, r4, lbl_803D68C8@l @@ -131,8 +131,8 @@ lbl_802C6564: /* 802C6570 002C34D0 7F A3 EB 78 */ mr r3, r29 /* 802C6574 002C34D4 80 9D 00 10 */ lwz r4, 0x10(r29) /* 802C6578 002C34D8 80 1D 00 0C */ lwz r0, 0xc(r29) -/* 802C657C 002C34DC 90 0D A6 48 */ stw r0, lbl_805A9208@sda21(r13) -/* 802C6580 002C34E0 90 8D A6 4C */ stw r4, lbl_805A920C@sda21(r13) +/* 802C657C 002C34DC 90 0D A6 48 */ stw r0, gpExecBuf__15CGuiTextSupport@sda21(r13) +/* 802C6580 002C34E0 90 8D A6 4C */ stw r4, gpTextParser__15CGuiTextSupport@sda21(r13) /* 802C6584 002C34E4 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 802C6588 002C34E8 83 C1 00 18 */ lwz r30, 0x18(r1) /* 802C658C 002C34EC 83 A1 00 14 */ lwz r29, 0x14(r1) @@ -141,8 +141,8 @@ lbl_802C6564: /* 802C6598 002C34F8 38 21 00 20 */ addi r1, r1, 0x20 /* 802C659C 002C34FC 4E 80 00 20 */ blr -.global sub_802c65a0 -sub_802c65a0: +.global "__as__Q24rstl32single_ptr<18CTextExecuteBuffer>FP18CTextExecuteBuffer" +"__as__Q24rstl32single_ptr<18CTextExecuteBuffer>FP18CTextExecuteBuffer": /* 802C65A0 002C3500 94 21 FF F0 */ stwu r1, -0x10(r1) /* 802C65A4 002C3504 7C 08 02 A6 */ mflr r0 /* 802C65A8 002C3508 90 01 00 14 */ stw r0, 0x14(r1) diff --git a/asm/GuiSys/CGuiTextSupport.s b/asm/GuiSys/CGuiTextSupport.s index 1bf508db..9cfc6fd8 100644 --- a/asm/GuiSys/CGuiTextSupport.s +++ b/asm/GuiSys/CGuiTextSupport.s @@ -26,11 +26,11 @@ lbl_805A86D4: .section .sbss, "wa" .balign 8 -.global lbl_805A9208 -lbl_805A9208: +.global gpExecBuf__15CGuiTextSupport +gpExecBuf__15CGuiTextSupport: .skip 0x4 -.global lbl_805A920C -lbl_805A920C: +.global gpTextParser__15CGuiTextSupport +gpTextParser__15CGuiTextSupport: .skip 0x4 .section .text, "ax" @@ -1127,7 +1127,7 @@ lbl_802C8B60: lbl_802C8B74: /* 802C8B74 002C5AD4 7F A3 EB 78 */ mr r3, r29 /* 802C8B78 002C5AD8 48 00 07 91 */ bl CheckAndRebuildTextBuffer__15CGuiTextSupportFv -/* 802C8B7C 002C5ADC 80 8D A6 48 */ lwz r4, lbl_805A9208@sda21(r13) +/* 802C8B7C 002C5ADC 80 8D A6 48 */ lwz r4, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C8B80 002C5AE0 38 61 00 30 */ addi r3, r1, 0x30 /* 802C8B84 002C5AE4 48 03 97 31 */ bl GetAssets__18CTextExecuteBufferFv /* 802C8B88 002C5AE8 38 7D 02 BC */ addi r3, r29, 0x2bc @@ -1168,7 +1168,7 @@ lbl_802C8BE0: /* 802C8C08 002C5B68 38 61 00 18 */ addi r3, r1, 0x18 /* 802C8C0C 002C5B6C 80 BD 00 38 */ lwz r5, 0x38(r29) /* 802C8C10 002C5B70 48 04 B7 3D */ bl __ct__9CVector2iFii -/* 802C8C14 002C5B74 80 8D A6 48 */ lwz r4, lbl_805A9208@sda21(r13) +/* 802C8C14 002C5B74 80 8D A6 48 */ lwz r4, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C8C18 002C5B78 7C 65 1B 78 */ mr r5, r3 /* 802C8C1C 002C5B7C 38 61 00 40 */ addi r3, r1, 0x40 /* 802C8C20 002C5B80 48 03 8F 11 */ bl BuildRenderBufferPages__18CTextExecuteBufferFRC9CVector2i @@ -1180,7 +1180,7 @@ lbl_802C8BE0: /* 802C8C38 002C5B98 48 00 14 B9 */ bl "__dt__Q24rstl25list<17CTextRenderBuffer>Fv" /* 802C8C3C 002C5B9C 48 00 00 54 */ b lbl_802C8C90 lbl_802C8C40: -/* 802C8C40 002C5BA0 80 8D A6 48 */ lwz r4, lbl_805A9208@sda21(r13) +/* 802C8C40 002C5BA0 80 8D A6 48 */ lwz r4, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C8C44 002C5BA4 38 61 00 58 */ addi r3, r1, 0x58 /* 802C8C48 002C5BA8 48 03 95 69 */ bl BuildRenderBuffer__18CTextExecuteBufferFv /* 802C8C4C 002C5BAC 38 7D 00 60 */ addi r3, r29, 0x60 @@ -1201,7 +1201,7 @@ lbl_802C8C40: /* 802C8C88 002C5BE8 90 7D 02 E4 */ stw r3, 0x2e4(r29) /* 802C8C8C 002C5BEC 90 1D 02 E8 */ stw r0, 0x2e8(r29) lbl_802C8C90: -/* 802C8C90 002C5BF0 80 6D A6 48 */ lwz r3, lbl_805A9208@sda21(r13) +/* 802C8C90 002C5BF0 80 6D A6 48 */ lwz r3, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C8C94 002C5BF4 48 03 B0 55 */ bl Clear__18CTextExecuteBufferFv /* 802C8C98 002C5BF8 48 00 00 0C */ b lbl_802C8CA4 lbl_802C8C9C: @@ -1705,18 +1705,18 @@ CheckAndRebuildTextBuffer__15CGuiTextSupportFv: /* 802C9310 002C6270 90 01 00 B4 */ stw r0, 0xb4(r1) /* 802C9314 002C6274 93 E1 00 AC */ stw r31, 0xac(r1) /* 802C9318 002C6278 7C 7F 1B 78 */ mr r31, r3 -/* 802C931C 002C627C 80 6D A6 48 */ lwz r3, lbl_805A9208@sda21(r13) +/* 802C931C 002C627C 80 6D A6 48 */ lwz r3, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C9320 002C6280 48 03 A9 C9 */ bl Clear__18CTextExecuteBufferFv /* 802C9324 002C6284 88 1F 00 14 */ lbz r0, 0x14(r31) /* 802C9328 002C6288 38 80 00 00 */ li r4, 0 -/* 802C932C 002C628C 80 6D A6 48 */ lwz r3, lbl_805A9208@sda21(r13) +/* 802C932C 002C628C 80 6D A6 48 */ lwz r3, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C9330 002C6290 38 A0 00 00 */ li r5, 0 /* 802C9334 002C6294 98 03 00 94 */ stb r0, 0x94(r3) /* 802C9338 002C6298 81 5F 00 18 */ lwz r10, 0x18(r31) /* 802C933C 002C629C 80 1F 00 1C */ lwz r0, 0x1c(r31) /* 802C9340 002C62A0 90 01 00 08 */ stw r0, 8(r1) /* 802C9344 002C62A4 88 1F 00 15 */ lbz r0, 0x15(r31) -/* 802C9348 002C62A8 80 6D A6 48 */ lwz r3, lbl_805A9208@sda21(r13) +/* 802C9348 002C62A8 80 6D A6 48 */ lwz r3, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C934C 002C62AC 7C 00 00 34 */ cntlzw r0, r0 /* 802C9350 002C62B0 80 DF 00 34 */ lwz r6, 0x34(r31) /* 802C9354 002C62B4 80 FF 00 38 */ lwz r7, 0x38(r31) @@ -1732,7 +1732,7 @@ CheckAndRebuildTextBuffer__15CGuiTextSupportFv: /* 802C937C 002C62DC 38 80 00 00 */ li r4, 0 /* 802C9380 002C62E0 C0 82 C3 F4 */ lfs f4, lbl_805AE114@sda21(r2) /* 802C9384 002C62E4 EC 60 00 F2 */ fmuls f3, f0, f3 -/* 802C9388 002C62E8 80 6D A6 48 */ lwz r3, lbl_805A9208@sda21(r13) +/* 802C9388 002C62E8 80 6D A6 48 */ lwz r3, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C938C 002C62EC EC 40 00 B2 */ fmuls f2, f0, f2 /* 802C9390 002C62F0 EC 20 00 72 */ fmuls f1, f0, f1 /* 802C9394 002C62F4 EC 00 01 72 */ fmuls f0, f0, f5 @@ -1766,7 +1766,7 @@ CheckAndRebuildTextBuffer__15CGuiTextSupportFv: /* 802C9404 002C6364 38 80 00 01 */ li r4, 1 /* 802C9408 002C6368 C0 82 C3 F4 */ lfs f4, lbl_805AE114@sda21(r2) /* 802C940C 002C636C EC 60 00 F2 */ fmuls f3, f0, f3 -/* 802C9410 002C6370 80 6D A6 48 */ lwz r3, lbl_805A9208@sda21(r13) +/* 802C9410 002C6370 80 6D A6 48 */ lwz r3, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C9414 002C6374 EC 40 00 B2 */ fmuls f2, f0, f2 /* 802C9418 002C6378 EC 20 00 72 */ fmuls f1, f0, f1 /* 802C941C 002C637C EC 00 01 72 */ fmuls f0, f0, f5 @@ -1829,13 +1829,13 @@ lbl_802C94FC: /* 802C94FC 002C645C 7F E4 FB 78 */ mr r4, r31 /* 802C9500 002C6460 38 61 00 4C */ addi r3, r1, 0x4c /* 802C9504 002C6464 48 07 41 49 */ bl "append__Q24rstl66basic_string,Q24rstl17rmemory_allocator>FRCQ24rstl66basic_string,Q24rstl17rmemory_allocator>" -/* 802C9508 002C6468 80 6D A6 4C */ lwz r3, lbl_805A920C@sda21(r13) -/* 802C950C 002C646C 80 8D A6 48 */ lwz r4, lbl_805A9208@sda21(r13) +/* 802C9508 002C6468 80 6D A6 4C */ lwz r3, gpTextParser__15CGuiTextSupport@sda21(r13) +/* 802C950C 002C646C 80 8D A6 48 */ lwz r4, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C9510 002C6470 80 A1 00 4C */ lwz r5, 0x4c(r1) /* 802C9514 002C6474 80 C1 00 54 */ lwz r6, 0x54(r1) /* 802C9518 002C6478 80 FF 00 20 */ lwz r7, 0x20(r31) /* 802C951C 002C647C 48 03 C2 31 */ bl ParseText__11CTextParserFR18CTextExecuteBufferPCwi -/* 802C9520 002C6480 80 6D A6 48 */ lwz r3, lbl_805A9208@sda21(r13) +/* 802C9520 002C6480 80 6D A6 48 */ lwz r3, gpExecBuf__15CGuiTextSupport@sda21(r13) /* 802C9524 002C6484 48 03 A6 05 */ bl EndBlock__18CTextExecuteBufferFv /* 802C9528 002C6488 38 61 00 4C */ addi r3, r1, 0x4c /* 802C952C 002C648C 48 07 3C 09 */ bl "internal_dereference__Q24rstl66basic_string,Q24rstl17rmemory_allocator>Fv" diff --git a/asm/MetroidPrime/main.s b/asm/MetroidPrime/main.s index d5f5fd5e..661c91bb 100644 --- a/asm/MetroidPrime/main.s +++ b/asm/MetroidPrime/main.s @@ -6084,7 +6084,7 @@ lbl_800074A8: /* 800074D8 00004438 80 6D A0 80 */ lwz r3, gpGameState@sda21(r13) /* 800074DC 0000443C 90 0D A0 70 */ stw r0, gGuiSystem@sda21(r13) /* 800074E0 00004440 38 63 01 7C */ addi r3, r3, 0x17c -/* 800074E4 00004444 90 0D A6 40 */ stw r0, lbl_805A9200@sda21(r13) +/* 800074E4 00004444 90 0D A6 40 */ stw r0, spGuiSys__7CGuiSys@sda21(r13) /* 800074E8 00004448 80 1E 00 34 */ lwz r0, 0x34(r30) /* 800074EC 0000444C 90 0D A0 7C */ stw r0, gpController@sda21(r13) /* 800074F0 00004450 48 20 7C 0D */ bl EnsureOptions__12CGameOptionsFv diff --git a/configure.py b/configure.py index e6a03b24..2ab32a7e 100755 --- a/configure.py +++ b/configure.py @@ -429,7 +429,7 @@ LIBS = [ ["GuiSys/CGuiObject", False], "GuiSys/CGuiPane", "GuiSys/CGuiSliderGroup", - "GuiSys/CGuiSys", + ["GuiSys/CGuiSys", True], "GuiSys/CGuiTableGroup", "GuiSys/CGuiTextPane", "GuiSys/CGuiTextSupport", diff --git a/include/GuiSys/CGuiSys.hpp b/include/GuiSys/CGuiSys.hpp index 3cec4083..a25e261b 100644 --- a/include/GuiSys/CGuiSys.hpp +++ b/include/GuiSys/CGuiSys.hpp @@ -3,13 +3,22 @@ #include "types.h" +#include "rstl/rc_ptr.hpp" +#include "rstl/single_ptr.hpp" + +#include "GuiSys/CGuiTextSupport.hpp" + class IFactory; class CSimplePool; +class CTextExecuteBuffer; +class CTextParser; +class CGuiWidget; class CGuiSys; extern CGuiSys* gGuiSystem; class CGuiSys { + public: enum EUsageMode { kUM_Zero, @@ -24,11 +33,21 @@ public: gGuiSystem = ptr; spGuiSys = ptr; } + static CGuiWidget* CreateWidgetInGame(uint type, CInputStream& in, + CGuiFrame* parent); + + void AddFactories(EUsageMode mode); private: - uchar pad[0x14]; - + IFactory* x0_resFactory; + CSimplePool* x4_resStore; + EUsageMode x8_mode; + rstl::single_ptr< CTextExecuteBuffer > xc_textExecuteBuffer; + rstl::single_ptr< CTextParser > x10_textParser; static CGuiSys* spGuiSys; }; + +CHECK_SIZEOF(CGuiSys, 0x14); + #endif // _CGUISYS diff --git a/include/GuiSys/CGuiTextSupport.hpp b/include/GuiSys/CGuiTextSupport.hpp index 762356d0..c612f451 100644 --- a/include/GuiSys/CGuiTextSupport.hpp +++ b/include/GuiSys/CGuiTextSupport.hpp @@ -4,12 +4,23 @@ #include "rstl/string.hpp" class CColor; +class CGuiFrame; +class CTextExecuteBuffer; +class CTextParser; class CGuiTextSupport { + static CTextExecuteBuffer* gpExecBuf; + static CTextParser* gpTextParser; + public: void SetText(const rstl::string&, bool multipage = false); void SetOutlineColor(const CColor& col); void SetFontColor(const CColor& col); + + static void Initialize(CTextExecuteBuffer* buf, CTextParser* parser) { + gpExecBuf = buf; + gpTextParser = parser; + } }; #endif // _CGUITEXTSUPPORT diff --git a/include/GuiSys/CGuiWidget.hpp b/include/GuiSys/CGuiWidget.hpp index 83ebd0d3..41f311cb 100644 --- a/include/GuiSys/CGuiWidget.hpp +++ b/include/GuiSys/CGuiWidget.hpp @@ -2,17 +2,27 @@ #define _CGUIWIDGET #include "GuiSys/CGuiObject.hpp" +#include "Kyoto/Graphics/CColor.hpp" #include "Kyoto/SObjectTag.hpp" -class CColor; class CFinalInput; -enum ETraversalMode { kTM_ChildrenAndSiblings = 0, kTM_Children = 1, kTM_Single = 2 }; +enum ETraversalMode { + kTM_ChildrenAndSiblings = 0, + kTM_Children = 1, + kTM_Single = 2, +}; class CGuiWidget : public CGuiObject { public: - enum EGuiModelDrawFlags { kGMDF_Shadeless = 0, kGMDF_Opaque = 1, kGMDF_Alpha = 2, kGMDF_Additive = 3, kGMDF_AlphaAdditiveOverdraw = 4 }; - class CGuiWidgetParms {}; + enum EGuiModelDrawFlags { + kGMDF_Shadeless = 0, + kGMDF_Opaque = 1, + kGMDF_Alpha = 2, + kGMDF_Additive = 3, + kGMDF_AlphaAdditiveOverdraw = 4 + }; + class CGuiWidgetParms; void Update(float dt) override; void Draw(const CGuiWidgetDrawParms& drawParms) override; @@ -29,10 +39,10 @@ public: virtual bool GetIsFinishedLoadingWidgetSpecific(); virtual void OnVisibleChange(); virtual void OnActiveChange(); - + void SetColor(const CColor& color); void SetVisibility(bool visible, ETraversalMode mode); - + private: short x70_selfId; short x72_parentId; @@ -55,5 +65,6 @@ private: }; CHECK_SIZEOF(CGuiWidget, 0xb8) +CGuiWidget* FGuiWidgetFactoryInGame(uint type, CGuiFrame* parent, CInputStream& in); #endif // _CGUIWIDGET diff --git a/include/Kyoto/Text/CTextExecuteBuffer.hpp b/include/Kyoto/Text/CTextExecuteBuffer.hpp index b054b480..222a69d7 100644 --- a/include/Kyoto/Text/CTextExecuteBuffer.hpp +++ b/include/Kyoto/Text/CTextExecuteBuffer.hpp @@ -1,6 +1,34 @@ #ifndef _CTEXTEXECUTEBUFFER #define _CTEXTEXECUTEBUFFER -class CTextExecuteBuffer {}; +#include "rstl/list.hpp" +#include "rstl/rc_ptr.hpp" + +#include "Kyoto/Text/CSaveableState.hpp" + +class CInstruction; +class CBlockInstruction; +class CLineInstruction; + +class CTextExecuteBuffer { + typedef rstl::list< rstl::ncrc_ptr< CInstruction > > InstList; + +public: + CTextExecuteBuffer(); + +private: + InstList x0_instructions; + CSaveableState x18_; + CBlockInstruction* xa0_curBlock; + CLineInstruction* xa4_curLine; + InstList::const_iterator xa8_curWordIt; + int xac_curY; + int xb0_curX; + int xb4_curWordX; + int xb8_curWordY; + int xbc_spaceDistance; + bool xc0_imageBaseline; + rstl::list xc4_stateStack; +}; #endif // _CTEXTEXECUTEBUFFER diff --git a/src/GuiSys/CGuiSys.cpp b/src/GuiSys/CGuiSys.cpp new file mode 100644 index 00000000..c0b376e9 --- /dev/null +++ b/src/GuiSys/CGuiSys.cpp @@ -0,0 +1,25 @@ +#include "GuiSys/CGuiSys.hpp" + +#include "GuiSys/CGuiTextSupport.hpp" +#include "GuiSys/CGuiWidget.hpp" +#include "Kyoto/Text/CTextExecuteBuffer.hpp" +#include "Kyoto/Text/CTextParser.hpp" + +CGuiSys* CGuiSys::spGuiSys = nullptr; + +CGuiSys::CGuiSys(IFactory* factory, CSimplePool* pool, EUsageMode mode) +: x0_resFactory(factory), x4_resStore(pool), x8_mode(mode) { + AddFactories(x8_mode); + xc_textExecuteBuffer = new CTextExecuteBuffer(); + x10_textParser = new CTextParser(*pool); + + CGuiTextSupport::Initialize(xc_textExecuteBuffer.get(), x10_textParser.get()); +} + +CGuiSys::~CGuiSys() {} + +CGuiWidget* CGuiSys::CreateWidgetInGame(FourCC type, CInputStream& in, CGuiFrame* parent) { + return FGuiWidgetFactoryInGame(type, parent, in); +} + +void CGuiSys::AddFactories(EUsageMode mode) {}