mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-04 11:19:58 -04:00
JKRThread & JKRThreadSwitch (#147)
* OK __ct__15JKRThreadSwitchFP7JKRHeap * OK createManager__15JKRThreadSwitchFP7JKRHeap * OK enter__15JKRThreadSwitchFP9JKRThreadi * OK callback__15JKRThreadSwitchFP8OSThreadP8OSThread * OK draw__15JKRThreadSwitchFP14JKRThreadName_P10JUTConsole * OK draw__15JKRThreadSwitchFP14JKRThreadName_ * OK __dt__15JKRThreadSwitchFv * JKRThread.cpp cleanup * Fixed tp.py and libelf, changed JUT_ASSERT macro and removed unused .s files. * Changed JKRThread access specifiers Co-authored-by: Julgodis <>
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
lbl_802D08CC:
|
||||
/* 802D08CC 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 802D08D0 7C 08 02 A6 */ mflr r0
|
||||
/* 802D08D4 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 802D08D8 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||
/* 802D08DC 93 C1 00 08 */ stw r30, 8(r1)
|
||||
/* 802D08E0 7C 7E 1B 78 */ mr r30, r3
|
||||
/* 802D08E4 7C 9F 23 78 */ mr r31, r4
|
||||
/* 802D08E8 7F E3 FB 78 */ mr r3, r31
|
||||
/* 802D08EC 7F C4 F3 78 */ mr r4, r30
|
||||
/* 802D08F0 4B FF F5 F9 */ bl removeUsedBlock__10JKRExpHeapFPQ210JKRExpHeap9CMemBlock
|
||||
/* 802D08F4 7F E3 FB 78 */ mr r3, r31
|
||||
/* 802D08F8 7F C4 F3 78 */ mr r4, r30
|
||||
/* 802D08FC 4B FF F6 21 */ bl recycleFreeBlock__10JKRExpHeapFPQ210JKRExpHeap9CMemBlock
|
||||
/* 802D0900 38 60 00 00 */ li r3, 0
|
||||
/* 802D0904 83 E1 00 0C */ lwz r31, 0xc(r1)
|
||||
/* 802D0908 83 C1 00 08 */ lwz r30, 8(r1)
|
||||
/* 802D090C 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 802D0910 7C 08 03 A6 */ mtlr r0
|
||||
/* 802D0914 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 802D0918 4E 80 00 20 */ blr
|
||||
@@ -1,31 +0,0 @@
|
||||
lbl_802D199C:
|
||||
/* 802D199C 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 802D19A0 7C 08 02 A6 */ mflr r0
|
||||
/* 802D19A4 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 802D19A8 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||
/* 802D19AC 7C 7F 1B 78 */ mr r31, r3
|
||||
/* 802D19B0 3C 60 80 3D */ lis r3, __vt__15JKRThreadSwitch@ha /* 0x803CC100@ha */
|
||||
/* 802D19B4 38 03 C1 00 */ addi r0, r3, __vt__15JKRThreadSwitch@l /* 0x803CC100@l */
|
||||
/* 802D19B8 90 1F 00 00 */ stw r0, 0(r31)
|
||||
/* 802D19BC 90 9F 00 04 */ stw r4, 4(r31)
|
||||
/* 802D19C0 3C 60 80 2D */ lis r3, callback__15JKRThreadSwitchFP8OSThreadP8OSThread@ha /* 0x802D1AE4@ha */
|
||||
/* 802D19C4 38 63 1A E4 */ addi r3, r3, callback__15JKRThreadSwitchFP8OSThreadP8OSThread@l /* 0x802D1AE4@l */
|
||||
/* 802D19C8 48 06 F0 E1 */ bl OSSetSwitchThreadCallback
|
||||
/* 802D19CC 38 60 00 00 */ li r3, 0
|
||||
/* 802D19D0 90 7F 00 0C */ stw r3, 0xc(r31)
|
||||
/* 802D19D4 38 00 00 01 */ li r0, 1
|
||||
/* 802D19D8 90 1F 00 10 */ stw r0, 0x10(r31)
|
||||
/* 802D19DC 90 7F 00 1C */ stw r3, 0x1c(r31)
|
||||
/* 802D19E0 90 7F 00 18 */ stw r3, 0x18(r31)
|
||||
/* 802D19E4 90 6D 8E 34 */ stw r3, sTotalCount__15JKRThreadSwitch(r13)
|
||||
/* 802D19E8 90 6D 8E 3C */ stw r3, data_804513BC(r13)
|
||||
/* 802D19EC 90 6D 8E 38 */ stw r3, sTotalStart__15JKRThreadSwitch(r13)
|
||||
/* 802D19F0 90 7F 00 20 */ stw r3, 0x20(r31)
|
||||
/* 802D19F4 90 7F 00 24 */ stw r3, 0x24(r31)
|
||||
/* 802D19F8 98 1F 00 08 */ stb r0, 8(r31)
|
||||
/* 802D19FC 7F E3 FB 78 */ mr r3, r31
|
||||
/* 802D1A00 83 E1 00 0C */ lwz r31, 0xc(r1)
|
||||
/* 802D1A04 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 802D1A08 7C 08 03 A6 */ mtlr r0
|
||||
/* 802D1A0C 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 802D1A10 4E 80 00 20 */ blr
|
||||
@@ -1,20 +0,0 @@
|
||||
lbl_802D1E4C:
|
||||
/* 802D1E4C 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 802D1E50 7C 08 02 A6 */ mflr r0
|
||||
/* 802D1E54 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 802D1E58 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||
/* 802D1E5C 7C 7F 1B 79 */ or. r31, r3, r3
|
||||
/* 802D1E60 41 82 00 1C */ beq lbl_802D1E7C
|
||||
/* 802D1E64 3C A0 80 3D */ lis r5, __vt__15JKRThreadSwitch@ha /* 0x803CC100@ha */
|
||||
/* 802D1E68 38 05 C1 00 */ addi r0, r5, __vt__15JKRThreadSwitch@l /* 0x803CC100@l */
|
||||
/* 802D1E6C 90 1F 00 00 */ stw r0, 0(r31)
|
||||
/* 802D1E70 7C 80 07 35 */ extsh. r0, r4
|
||||
/* 802D1E74 40 81 00 08 */ ble lbl_802D1E7C
|
||||
/* 802D1E78 4B FF CE C5 */ bl __dl__FPv
|
||||
lbl_802D1E7C:
|
||||
/* 802D1E7C 7F E3 FB 78 */ mr r3, r31
|
||||
/* 802D1E80 83 E1 00 0C */ lwz r31, 0xc(r1)
|
||||
/* 802D1E84 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 802D1E88 7C 08 03 A6 */ mtlr r0
|
||||
/* 802D1E8C 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 802D1E90 4E 80 00 20 */ blr
|
||||
@@ -1,114 +0,0 @@
|
||||
lbl_802D1AE4:
|
||||
/* 802D1AE4 94 21 FF E0 */ stwu r1, -0x20(r1)
|
||||
/* 802D1AE8 7C 08 02 A6 */ mflr r0
|
||||
/* 802D1AEC 90 01 00 24 */ stw r0, 0x24(r1)
|
||||
/* 802D1AF0 39 61 00 20 */ addi r11, r1, 0x20
|
||||
/* 802D1AF4 48 09 06 E1 */ bl _savegpr_27
|
||||
/* 802D1AF8 7C 7B 1B 78 */ mr r27, r3
|
||||
/* 802D1AFC 7C 9C 23 78 */ mr r28, r4
|
||||
/* 802D1B00 81 8D 8E 40 */ lwz r12, mUserPreCallback__15JKRThreadSwitch(r13)
|
||||
/* 802D1B04 28 0C 00 00 */ cmplwi r12, 0
|
||||
/* 802D1B08 41 82 00 0C */ beq lbl_802D1B14
|
||||
/* 802D1B0C 7D 89 03 A6 */ mtctr r12
|
||||
/* 802D1B10 4E 80 04 21 */ bctrl
|
||||
lbl_802D1B14:
|
||||
/* 802D1B14 80 6D 8E 34 */ lwz r3, sTotalCount__15JKRThreadSwitch(r13)
|
||||
/* 802D1B18 38 03 00 01 */ addi r0, r3, 1
|
||||
/* 802D1B1C 90 0D 8E 34 */ stw r0, sTotalCount__15JKRThreadSwitch(r13)
|
||||
/* 802D1B20 3B A0 00 00 */ li r29, 0
|
||||
/* 802D1B24 3C 60 80 43 */ lis r3, sThreadList__9JKRThread@ha /* 0x8043428C@ha */
|
||||
/* 802D1B28 83 C3 42 8C */ lwz r30, sThreadList__9JKRThread@l(r3) /* 0x8043428C@l */
|
||||
/* 802D1B2C 48 00 00 FC */ b lbl_802D1C28
|
||||
lbl_802D1B30:
|
||||
/* 802D1B30 83 FE 00 00 */ lwz r31, 0(r30)
|
||||
/* 802D1B34 80 1F 00 2C */ lwz r0, 0x2c(r31)
|
||||
/* 802D1B38 7C 00 D8 40 */ cmplw r0, r27
|
||||
/* 802D1B3C 40 82 00 34 */ bne lbl_802D1B70
|
||||
/* 802D1B40 80 0D 8D F4 */ lwz r0, sCurrentHeap__7JKRHeap(r13)
|
||||
/* 802D1B44 28 00 00 00 */ cmplwi r0, 0
|
||||
/* 802D1B48 90 1F 00 74 */ stw r0, 0x74(r31)
|
||||
/* 802D1B4C 88 1F 00 60 */ lbz r0, 0x60(r31)
|
||||
/* 802D1B50 28 00 00 00 */ cmplwi r0, 0
|
||||
/* 802D1B54 41 82 00 1C */ beq lbl_802D1B70
|
||||
/* 802D1B58 48 07 0B BD */ bl OSGetTick
|
||||
/* 802D1B5C 80 1F 00 6C */ lwz r0, 0x6c(r31)
|
||||
/* 802D1B60 7C 60 18 50 */ subf r3, r0, r3
|
||||
/* 802D1B64 80 1F 00 64 */ lwz r0, 0x64(r31)
|
||||
/* 802D1B68 7C 00 1A 14 */ add r0, r0, r3
|
||||
/* 802D1B6C 90 1F 00 64 */ stw r0, 0x64(r31)
|
||||
lbl_802D1B70:
|
||||
/* 802D1B70 80 1F 00 2C */ lwz r0, 0x2c(r31)
|
||||
/* 802D1B74 7C 00 E0 40 */ cmplw r0, r28
|
||||
/* 802D1B78 40 82 00 AC */ bne lbl_802D1C24
|
||||
/* 802D1B7C 88 1F 00 60 */ lbz r0, 0x60(r31)
|
||||
/* 802D1B80 28 00 00 00 */ cmplwi r0, 0
|
||||
/* 802D1B84 41 82 00 18 */ beq lbl_802D1B9C
|
||||
/* 802D1B88 48 07 0B 8D */ bl OSGetTick
|
||||
/* 802D1B8C 90 7F 00 6C */ stw r3, 0x6c(r31)
|
||||
/* 802D1B90 80 7F 00 68 */ lwz r3, 0x68(r31)
|
||||
/* 802D1B94 38 03 00 01 */ addi r0, r3, 1
|
||||
/* 802D1B98 90 1F 00 68 */ stw r0, 0x68(r31)
|
||||
lbl_802D1B9C:
|
||||
/* 802D1B9C 80 6D 8E 30 */ lwz r3, sManager__15JKRThreadSwitch(r13)
|
||||
/* 802D1BA0 88 03 00 08 */ lbz r0, 8(r3)
|
||||
/* 802D1BA4 28 00 00 00 */ cmplwi r0, 0
|
||||
/* 802D1BA8 41 82 00 7C */ beq lbl_802D1C24
|
||||
/* 802D1BAC 80 9F 00 74 */ lwz r4, 0x74(r31)
|
||||
/* 802D1BB0 7C 9D 23 78 */ mr r29, r4
|
||||
/* 802D1BB4 28 04 00 00 */ cmplwi r4, 0
|
||||
/* 802D1BB8 40 82 00 0C */ bne lbl_802D1BC4
|
||||
/* 802D1BBC 83 AD 8D F4 */ lwz r29, sCurrentHeap__7JKRHeap(r13)
|
||||
/* 802D1BC0 48 00 00 64 */ b lbl_802D1C24
|
||||
lbl_802D1BC4:
|
||||
/* 802D1BC4 80 6D 8D F8 */ lwz r3, sRootHeap__7JKRHeap(r13)
|
||||
/* 802D1BC8 4B FF CF E1 */ bl isSubHeap__7JKRHeapCFP7JKRHeap
|
||||
/* 802D1BCC 54 60 06 3F */ clrlwi. r0, r3, 0x18
|
||||
/* 802D1BD0 40 82 00 54 */ bne lbl_802D1C24
|
||||
/* 802D1BD4 80 1F 00 78 */ lwz r0, 0x78(r31)
|
||||
/* 802D1BD8 2C 00 00 02 */ cmpwi r0, 2
|
||||
/* 802D1BDC 41 82 00 3C */ beq lbl_802D1C18
|
||||
/* 802D1BE0 40 80 00 14 */ bge lbl_802D1BF4
|
||||
/* 802D1BE4 2C 00 00 00 */ cmpwi r0, 0
|
||||
/* 802D1BE8 41 82 00 3C */ beq lbl_802D1C24
|
||||
/* 802D1BEC 40 80 00 14 */ bge lbl_802D1C00
|
||||
/* 802D1BF0 48 00 00 34 */ b lbl_802D1C24
|
||||
lbl_802D1BF4:
|
||||
/* 802D1BF4 2C 00 00 04 */ cmpwi r0, 4
|
||||
/* 802D1BF8 40 80 00 2C */ bge lbl_802D1C24
|
||||
/* 802D1BFC 48 00 00 24 */ b lbl_802D1C20
|
||||
lbl_802D1C00:
|
||||
/* 802D1C00 3C 60 80 3A */ lis r3, JKRThread__stringBase0@ha /* 0x8039CFA8@ha */
|
||||
/* 802D1C04 38 63 CF A8 */ addi r3, r3, JKRThread__stringBase0@l /* 0x8039CFA8@l */
|
||||
/* 802D1C08 38 63 00 34 */ addi r3, r3, 0x34
|
||||
/* 802D1C0C 48 01 6A F1 */ bl JUTWarningConsole
|
||||
/* 802D1C10 83 AD 8D F4 */ lwz r29, sCurrentHeap__7JKRHeap(r13)
|
||||
/* 802D1C14 48 00 00 10 */ b lbl_802D1C24
|
||||
lbl_802D1C18:
|
||||
/* 802D1C18 83 AD 8D F4 */ lwz r29, sCurrentHeap__7JKRHeap(r13)
|
||||
/* 802D1C1C 48 00 00 08 */ b lbl_802D1C24
|
||||
lbl_802D1C20:
|
||||
/* 802D1C20 83 AD 8D F0 */ lwz r29, sSystemHeap__7JKRHeap(r13)
|
||||
lbl_802D1C24:
|
||||
/* 802D1C24 83 DE 00 0C */ lwz r30, 0xc(r30)
|
||||
lbl_802D1C28:
|
||||
/* 802D1C28 28 1E 00 00 */ cmplwi r30, 0
|
||||
/* 802D1C2C 40 82 FF 04 */ bne lbl_802D1B30
|
||||
/* 802D1C30 28 1D 00 00 */ cmplwi r29, 0
|
||||
/* 802D1C34 41 82 00 0C */ beq lbl_802D1C40
|
||||
/* 802D1C38 7F A3 EB 78 */ mr r3, r29
|
||||
/* 802D1C3C 4B FF C7 FD */ bl becomeCurrentHeap__7JKRHeapFv
|
||||
lbl_802D1C40:
|
||||
/* 802D1C40 81 8D 8E 44 */ lwz r12, mUserPostCallback__15JKRThreadSwitch(r13)
|
||||
/* 802D1C44 28 0C 00 00 */ cmplwi r12, 0
|
||||
/* 802D1C48 41 82 00 14 */ beq lbl_802D1C5C
|
||||
/* 802D1C4C 7F 63 DB 78 */ mr r3, r27
|
||||
/* 802D1C50 7F 84 E3 78 */ mr r4, r28
|
||||
/* 802D1C54 7D 89 03 A6 */ mtctr r12
|
||||
/* 802D1C58 4E 80 04 21 */ bctrl
|
||||
lbl_802D1C5C:
|
||||
/* 802D1C5C 39 61 00 20 */ addi r11, r1, 0x20
|
||||
/* 802D1C60 48 09 05 C1 */ bl _restgpr_27
|
||||
/* 802D1C64 80 01 00 24 */ lwz r0, 0x24(r1)
|
||||
/* 802D1C68 7C 08 03 A6 */ mtlr r0
|
||||
/* 802D1C6C 38 21 00 20 */ addi r1, r1, 0x20
|
||||
/* 802D1C70 4E 80 00 20 */ blr
|
||||
@@ -1,26 +0,0 @@
|
||||
lbl_802D1A14:
|
||||
/* 802D1A14 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 802D1A18 7C 08 02 A6 */ mflr r0
|
||||
/* 802D1A1C 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 802D1A20 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||
/* 802D1A24 7C 7F 1B 79 */ or. r31, r3, r3
|
||||
/* 802D1A28 40 82 00 08 */ bne lbl_802D1A30
|
||||
/* 802D1A2C 83 ED 8D F4 */ lwz r31, sCurrentHeap__7JKRHeap(r13)
|
||||
lbl_802D1A30:
|
||||
/* 802D1A30 38 60 00 28 */ li r3, 0x28
|
||||
/* 802D1A34 7F E4 FB 78 */ mr r4, r31
|
||||
/* 802D1A38 38 A0 00 00 */ li r5, 0
|
||||
/* 802D1A3C 4B FF D2 5D */ bl __nw__FUlP7JKRHeapi
|
||||
/* 802D1A40 7C 60 1B 79 */ or. r0, r3, r3
|
||||
/* 802D1A44 41 82 00 10 */ beq lbl_802D1A54
|
||||
/* 802D1A48 7F E4 FB 78 */ mr r4, r31
|
||||
/* 802D1A4C 4B FF FF 51 */ bl __ct__15JKRThreadSwitchFP7JKRHeap
|
||||
/* 802D1A50 7C 60 1B 78 */ mr r0, r3
|
||||
lbl_802D1A54:
|
||||
/* 802D1A54 90 0D 8E 30 */ stw r0, sManager__15JKRThreadSwitch(r13)
|
||||
/* 802D1A58 7C 03 03 78 */ mr r3, r0
|
||||
/* 802D1A5C 83 E1 00 0C */ lwz r31, 0xc(r1)
|
||||
/* 802D1A60 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 802D1A64 7C 08 03 A6 */ mtlr r0
|
||||
/* 802D1A68 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 802D1A6C 4E 80 00 20 */ blr
|
||||
@@ -1,13 +0,0 @@
|
||||
lbl_802D1E1C:
|
||||
/* 802D1E1C 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 802D1E20 7C 08 02 A6 */ mflr r0
|
||||
/* 802D1E24 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 802D1E28 38 A0 00 00 */ li r5, 0
|
||||
/* 802D1E2C 81 83 00 00 */ lwz r12, 0(r3)
|
||||
/* 802D1E30 81 8C 00 08 */ lwz r12, 8(r12)
|
||||
/* 802D1E34 7D 89 03 A6 */ mtctr r12
|
||||
/* 802D1E38 4E 80 04 21 */ bctrl
|
||||
/* 802D1E3C 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 802D1E40 7C 08 03 A6 */ mtlr r0
|
||||
/* 802D1E44 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 802D1E48 4E 80 00 20 */ blr
|
||||
-114
@@ -1,114 +0,0 @@
|
||||
lbl_802D1C74:
|
||||
/* 802D1C74 94 21 FF B0 */ stwu r1, -0x50(r1)
|
||||
/* 802D1C78 7C 08 02 A6 */ mflr r0
|
||||
/* 802D1C7C 90 01 00 54 */ stw r0, 0x54(r1)
|
||||
/* 802D1C80 DB E1 00 40 */ stfd f31, 0x40(r1)
|
||||
/* 802D1C84 F3 E1 00 48 */ psq_st f31, 72(r1), 0, 0 /* qr0 */
|
||||
/* 802D1C88 39 61 00 40 */ addi r11, r1, 0x40
|
||||
/* 802D1C8C 48 09 05 41 */ bl _savegpr_25
|
||||
/* 802D1C90 7C 7A 1B 78 */ mr r26, r3
|
||||
/* 802D1C94 7C 9B 23 78 */ mr r27, r4
|
||||
/* 802D1C98 7C BC 2B 79 */ or. r28, r5, r5
|
||||
/* 802D1C9C 3C 60 80 3A */ lis r3, JKRThread__stringBase0@ha /* 0x8039CFA8@ha */
|
||||
/* 802D1CA0 38 63 CF A8 */ addi r3, r3, JKRThread__stringBase0@l /* 0x8039CFA8@l */
|
||||
/* 802D1CA4 3B 23 00 5D */ addi r25, r3, 0x5d
|
||||
/* 802D1CA8 3B A3 00 7F */ addi r29, r3, 0x7f
|
||||
/* 802D1CAC 41 82 00 34 */ beq lbl_802D1CE0
|
||||
/* 802D1CB0 7F 83 E3 78 */ mr r3, r28
|
||||
/* 802D1CB4 48 01 59 39 */ bl clear__10JUTConsoleFv
|
||||
/* 802D1CB8 7F 83 E3 78 */ mr r3, r28
|
||||
/* 802D1CBC 7F 24 CB 78 */ mr r4, r25
|
||||
/* 802D1CC0 80 AD 8E 34 */ lwz r5, sTotalCount__15JKRThreadSwitch(r13)
|
||||
/* 802D1CC4 80 DA 00 1C */ lwz r6, 0x1c(r26)
|
||||
/* 802D1CC8 80 FA 00 10 */ lwz r7, 0x10(r26)
|
||||
/* 802D1CCC 4C C6 31 82 */ crclr 6
|
||||
/* 802D1CD0 48 01 5E E9 */ bl print_f__10JUTConsoleFPCce
|
||||
/* 802D1CD4 7F 83 E3 78 */ mr r3, r28
|
||||
/* 802D1CD8 7F A4 EB 78 */ mr r4, r29
|
||||
/* 802D1CDC 48 01 5F 5D */ bl print__10JUTConsoleFPCc
|
||||
lbl_802D1CE0:
|
||||
/* 802D1CE0 3C 60 80 43 */ lis r3, sThreadList__9JKRThread@ha /* 0x8043428C@ha */
|
||||
/* 802D1CE4 83 C3 42 8C */ lwz r30, sThreadList__9JKRThread@l(r3) /* 0x8043428C@l */
|
||||
/* 802D1CE8 48 00 01 04 */ b lbl_802D1DEC
|
||||
lbl_802D1CEC:
|
||||
/* 802D1CEC 83 3E 00 00 */ lwz r25, 0(r30)
|
||||
/* 802D1CF0 88 19 00 60 */ lbz r0, 0x60(r25)
|
||||
/* 802D1CF4 28 00 00 00 */ cmplwi r0, 0
|
||||
/* 802D1CF8 41 82 00 F0 */ beq lbl_802D1DE8
|
||||
/* 802D1CFC 3B A0 00 00 */ li r29, 0
|
||||
/* 802D1D00 28 1B 00 00 */ cmplwi r27, 0
|
||||
/* 802D1D04 41 82 00 34 */ beq lbl_802D1D38
|
||||
/* 802D1D08 7F 65 DB 78 */ mr r5, r27
|
||||
/* 802D1D0C 48 00 00 20 */ b lbl_802D1D2C
|
||||
lbl_802D1D10:
|
||||
/* 802D1D10 80 65 00 00 */ lwz r3, 0(r5)
|
||||
/* 802D1D14 80 19 00 70 */ lwz r0, 0x70(r25)
|
||||
/* 802D1D18 7C 03 00 00 */ cmpw r3, r0
|
||||
/* 802D1D1C 40 82 00 0C */ bne lbl_802D1D28
|
||||
/* 802D1D20 7C 9D 23 78 */ mr r29, r4
|
||||
/* 802D1D24 48 00 00 14 */ b lbl_802D1D38
|
||||
lbl_802D1D28:
|
||||
/* 802D1D28 38 A5 00 08 */ addi r5, r5, 8
|
||||
lbl_802D1D2C:
|
||||
/* 802D1D2C 80 85 00 04 */ lwz r4, 4(r5)
|
||||
/* 802D1D30 28 04 00 00 */ cmplwi r4, 0
|
||||
/* 802D1D34 40 82 FF DC */ bne lbl_802D1D10
|
||||
lbl_802D1D38:
|
||||
/* 802D1D38 28 1D 00 00 */ cmplwi r29, 0
|
||||
/* 802D1D3C 40 82 00 24 */ bne lbl_802D1D60
|
||||
/* 802D1D40 38 61 00 08 */ addi r3, r1, 8
|
||||
/* 802D1D44 3C 80 80 3A */ lis r4, JKRThread__stringBase0@ha /* 0x8039CFA8@ha */
|
||||
/* 802D1D48 38 84 CF A8 */ addi r4, r4, JKRThread__stringBase0@l /* 0x8039CFA8@l */
|
||||
/* 802D1D4C 38 84 00 A7 */ addi r4, r4, 0xa7
|
||||
/* 802D1D50 80 B9 00 70 */ lwz r5, 0x70(r25)
|
||||
/* 802D1D54 4C C6 31 82 */ crclr 6
|
||||
/* 802D1D58 48 09 47 85 */ bl sprintf
|
||||
/* 802D1D5C 3B A1 00 08 */ addi r29, r1, 8
|
||||
lbl_802D1D60:
|
||||
/* 802D1D60 83 F9 00 68 */ lwz r31, 0x68(r25)
|
||||
/* 802D1D64 80 7A 00 18 */ lwz r3, 0x18(r26)
|
||||
/* 802D1D68 80 9A 00 1C */ lwz r4, 0x1c(r26)
|
||||
/* 802D1D6C 48 09 09 51 */ bl __cvt_sll_flt
|
||||
/* 802D1D70 80 19 00 64 */ lwz r0, 0x64(r25)
|
||||
/* 802D1D74 C8 42 C5 C8 */ lfd f2, lit_937(r2)
|
||||
/* 802D1D78 90 01 00 1C */ stw r0, 0x1c(r1)
|
||||
/* 802D1D7C 3C 00 43 30 */ lis r0, 0x4330
|
||||
/* 802D1D80 90 01 00 18 */ stw r0, 0x18(r1)
|
||||
/* 802D1D84 C8 01 00 18 */ lfd f0, 0x18(r1)
|
||||
/* 802D1D88 EC 00 10 28 */ fsubs f0, f0, f2
|
||||
/* 802D1D8C EF E0 08 24 */ fdivs f31, f0, f1
|
||||
/* 802D1D90 C0 02 C5 C0 */ lfs f0, lit_934(r2)
|
||||
/* 802D1D94 EC 20 07 F2 */ fmuls f1, f0, f31
|
||||
/* 802D1D98 48 09 03 15 */ bl __cvt_fp2unsigned
|
||||
/* 802D1D9C 7C 79 1B 78 */ mr r25, r3
|
||||
/* 802D1DA0 C0 02 C5 C4 */ lfs f0, lit_935(r2)
|
||||
/* 802D1DA4 EC 20 07 F2 */ fmuls f1, f0, f31
|
||||
/* 802D1DA8 48 09 03 05 */ bl __cvt_fp2unsigned
|
||||
/* 802D1DAC 38 80 00 0A */ li r4, 0xa
|
||||
/* 802D1DB0 7C 03 23 96 */ divwu r0, r3, r4
|
||||
/* 802D1DB4 7C 00 21 D6 */ mullw r0, r0, r4
|
||||
/* 802D1DB8 7D 00 18 50 */ subf r8, r0, r3
|
||||
/* 802D1DBC 28 1C 00 00 */ cmplwi r28, 0
|
||||
/* 802D1DC0 41 82 00 28 */ beq lbl_802D1DE8
|
||||
/* 802D1DC4 7F 83 E3 78 */ mr r3, r28
|
||||
/* 802D1DC8 3C 80 80 3A */ lis r4, JKRThread__stringBase0@ha /* 0x8039CFA8@ha */
|
||||
/* 802D1DCC 38 84 CF A8 */ addi r4, r4, JKRThread__stringBase0@l /* 0x8039CFA8@l */
|
||||
/* 802D1DD0 38 84 00 AA */ addi r4, r4, 0xaa
|
||||
/* 802D1DD4 7F A5 EB 78 */ mr r5, r29
|
||||
/* 802D1DD8 7F E6 FB 78 */ mr r6, r31
|
||||
/* 802D1DDC 7F 27 CB 78 */ mr r7, r25
|
||||
/* 802D1DE0 4C C6 31 82 */ crclr 6
|
||||
/* 802D1DE4 48 01 5D D5 */ bl print_f__10JUTConsoleFPCce
|
||||
lbl_802D1DE8:
|
||||
/* 802D1DE8 83 DE 00 0C */ lwz r30, 0xc(r30)
|
||||
lbl_802D1DEC:
|
||||
/* 802D1DEC 28 1E 00 00 */ cmplwi r30, 0
|
||||
/* 802D1DF0 40 82 FE FC */ bne lbl_802D1CEC
|
||||
/* 802D1DF4 E3 E1 00 48 */ psq_l f31, 72(r1), 0, 0 /* qr0 */
|
||||
/* 802D1DF8 CB E1 00 40 */ lfd f31, 0x40(r1)
|
||||
/* 802D1DFC 39 61 00 40 */ addi r11, r1, 0x40
|
||||
/* 802D1E00 48 09 04 19 */ bl _restgpr_25
|
||||
/* 802D1E04 80 01 00 54 */ lwz r0, 0x54(r1)
|
||||
/* 802D1E08 7C 08 03 A6 */ mtlr r0
|
||||
/* 802D1E0C 38 21 00 50 */ addi r1, r1, 0x50
|
||||
/* 802D1E10 4E 80 00 20 */ blr
|
||||
@@ -1,33 +0,0 @@
|
||||
lbl_802D1A70:
|
||||
/* 802D1A70 94 21 FF F0 */ stwu r1, -0x10(r1)
|
||||
/* 802D1A74 7C 08 02 A6 */ mflr r0
|
||||
/* 802D1A78 90 01 00 14 */ stw r0, 0x14(r1)
|
||||
/* 802D1A7C 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||
/* 802D1A80 93 C1 00 08 */ stw r30, 8(r1)
|
||||
/* 802D1A84 7C 9E 23 79 */ or. r30, r4, r4
|
||||
/* 802D1A88 7C BF 2B 78 */ mr r31, r5
|
||||
/* 802D1A8C 40 82 00 0C */ bne lbl_802D1A98
|
||||
/* 802D1A90 38 60 00 00 */ li r3, 0
|
||||
/* 802D1A94 48 00 00 38 */ b lbl_802D1ACC
|
||||
lbl_802D1A98:
|
||||
/* 802D1A98 80 7E 00 2C */ lwz r3, 0x2c(r30)
|
||||
/* 802D1A9C 4B FF FE C5 */ bl searchThread__9JKRThreadFP8OSThread
|
||||
/* 802D1AA0 28 03 00 00 */ cmplwi r3, 0
|
||||
/* 802D1AA4 41 82 00 08 */ beq lbl_802D1AAC
|
||||
/* 802D1AA8 7C 7E 1B 78 */ mr r30, r3
|
||||
lbl_802D1AAC:
|
||||
/* 802D1AAC 38 00 00 00 */ li r0, 0
|
||||
/* 802D1AB0 90 1E 00 68 */ stw r0, 0x68(r30)
|
||||
/* 802D1AB4 90 1E 00 64 */ stw r0, 0x64(r30)
|
||||
/* 802D1AB8 90 1E 00 6C */ stw r0, 0x6c(r30)
|
||||
/* 802D1ABC 38 00 00 01 */ li r0, 1
|
||||
/* 802D1AC0 98 1E 00 60 */ stb r0, 0x60(r30)
|
||||
/* 802D1AC4 93 FE 00 70 */ stw r31, 0x70(r30)
|
||||
/* 802D1AC8 7F C3 F3 78 */ mr r3, r30
|
||||
lbl_802D1ACC:
|
||||
/* 802D1ACC 83 E1 00 0C */ lwz r31, 0xc(r1)
|
||||
/* 802D1AD0 83 C1 00 08 */ lwz r30, 8(r1)
|
||||
/* 802D1AD4 80 01 00 14 */ lwz r0, 0x14(r1)
|
||||
/* 802D1AD8 7C 08 03 A6 */ mtlr r0
|
||||
/* 802D1ADC 38 21 00 10 */ addi r1, r1, 0x10
|
||||
/* 802D1AE0 4E 80 00 20 */ blr
|
||||
@@ -2,6 +2,7 @@
|
||||
#define JAISOUND_H
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "global.h"
|
||||
|
||||
@@ -153,11 +154,11 @@ public:
|
||||
JAISoundHandle(); // noninline in JAUClusterSound.cpp
|
||||
~JAISoundHandle();
|
||||
|
||||
bool isSoundAttached() const { return mSound != NULL; }
|
||||
bool isSoundAttached() const { return sound_ != NULL; }
|
||||
|
||||
JAISound* operator->() const {
|
||||
JUT_ASSERT(mSound != NULL);
|
||||
return mSound;
|
||||
JUT_ASSERT("JAISound.h", 0x3a, sound_ != 0);
|
||||
return sound_;
|
||||
}
|
||||
|
||||
operator bool() const { return isSoundAttached(); }
|
||||
@@ -165,7 +166,7 @@ public:
|
||||
void releaseSound();
|
||||
|
||||
private:
|
||||
JAISound* mSound;
|
||||
JAISound* sound_; // member from assert in operator->()
|
||||
};
|
||||
|
||||
class JAISoundHandles {
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
/* 0x00 */ // vtable
|
||||
/* 0x04 */ JKRHeap* mHeap;
|
||||
/* 0x08 */ JSULink<JKRDisposer> mLink;
|
||||
/* 0x18 */
|
||||
};
|
||||
|
||||
#endif /* JKRDISPOSER_H */
|
||||
|
||||
@@ -140,6 +140,10 @@ public:
|
||||
static void* getUserRamEnd(void) { return mUserRamEnd; }
|
||||
static u32 getMemorySize(void) { return mMemorySize; }
|
||||
static JKRHeap* getRootHeap() { return sRootHeap; }
|
||||
#if DEBUG
|
||||
static JKRHeap* getRootHeap2() { return sRootHeap2; }
|
||||
#endif
|
||||
|
||||
static JKRHeap* getSystemHeap() { return sSystemHeap; }
|
||||
static JKRHeap* getCurrentHeap() { return sCurrentHeap; }
|
||||
static void setSystemHeap(JKRHeap* heap) { sSystemHeap = heap; }
|
||||
@@ -160,6 +164,10 @@ public:
|
||||
static u32 mMemorySize;
|
||||
|
||||
static JKRHeap* sRootHeap;
|
||||
#if DEBUG
|
||||
static JKRHeap* sRootHeap2;
|
||||
#endif
|
||||
|
||||
static JKRHeap* sSystemHeap;
|
||||
static JKRHeap* sCurrentHeap;
|
||||
|
||||
|
||||
@@ -2,15 +2,58 @@
|
||||
#define JKRTHREAD_H
|
||||
|
||||
#include "JSystem/JKernel/JKRDisposer.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
#include "dolphin/os/OS.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class JKRThreadName_;
|
||||
struct JKRThreadName_ {
|
||||
s32 id;
|
||||
char* name;
|
||||
};
|
||||
|
||||
class JUTConsole;
|
||||
class JKRHeap;
|
||||
class JKRThread : JKRDisposer {
|
||||
public:
|
||||
class TLoad {
|
||||
public:
|
||||
TLoad() {
|
||||
clear();
|
||||
mValid = false;
|
||||
mThreadId = 0;
|
||||
}
|
||||
|
||||
bool isValid() const { return mValid; }
|
||||
u32 getCost() const { return mCost; }
|
||||
u32 getCount() const { return mSwitchCount; }
|
||||
s32 getId() const { return mThreadId; }
|
||||
|
||||
void setValid(bool valid) { mValid = valid; }
|
||||
void setId(s32 id) { mThreadId = id; }
|
||||
void setCurrentTime() { mLastTick = OSGetTick(); }
|
||||
|
||||
void resetCost() { mCost = 0; }
|
||||
void resetCount() { mSwitchCount = 0; }
|
||||
|
||||
void incCount() { mSwitchCount++; }
|
||||
void addCurrentCost() { mCost = mCost + (OSGetTick() - mLastTick); }
|
||||
|
||||
void clear() {
|
||||
resetCount();
|
||||
resetCost();
|
||||
mLastTick = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x00 */ bool mValid;
|
||||
/* 0x01 */ u8 padding_0x61[3];
|
||||
/* 0x04 */ u32 mCost;
|
||||
/* 0x08 */ u32 mSwitchCount;
|
||||
/* 0x0C */ OSTick mLastTick;
|
||||
/* 0x10 */ s32 mThreadId;
|
||||
};
|
||||
|
||||
JKRThread(u32 stack_size, int message_count, int param_3);
|
||||
JKRThread(JKRHeap* heap, u32 stack_size, int message_count, int param_4);
|
||||
JKRThread(OSThread* thread, int message_count);
|
||||
@@ -23,9 +66,17 @@ public:
|
||||
|
||||
OSThread* getThreadRecord() const { return mThreadRecord; }
|
||||
void* getStack() const { return mStackMemory; }
|
||||
u8 getLoadInfo() const { return field_0x60; }
|
||||
TLoad* getLoadInfo() { return &mLoadInfo; }
|
||||
JKRHeap* getCurrentHeap() const { return mCurrentHeap; }
|
||||
JKRHeap* getCurrentHeapError() const { return mCurrentHeapError; }
|
||||
s32 getCurrentHeapError() const { return mCurrentHeapError; }
|
||||
|
||||
void setCurrentHeap(JKRHeap* heap) {
|
||||
if (!heap) {
|
||||
heap = JKRHeap::getCurrentHeap();
|
||||
}
|
||||
|
||||
mCurrentHeap = heap;
|
||||
}
|
||||
|
||||
protected:
|
||||
void resume() { OSResumeThread(mThreadRecord); }
|
||||
@@ -60,14 +111,9 @@ private:
|
||||
/* 0x54 */ s32 mMessageCount;
|
||||
/* 0x58 */ void* mStackMemory;
|
||||
/* 0x5C */ u32 mStackSize;
|
||||
/* 0x60 */ u8 field_0x60;
|
||||
/* 0x61 */ u8 padding_0x61[3];
|
||||
/* 0x64 */ u32 mCost;
|
||||
/* 0x68 */ u32 mSwitchCount;
|
||||
/* 0x6C */ u32 field_0x6c;
|
||||
/* 0x70 */ u32 field_0x70;
|
||||
/* 0x60 */ TLoad mLoadInfo;
|
||||
/* 0x74 */ JKRHeap* mCurrentHeap;
|
||||
/* 0x78 */ JKRHeap* mCurrentHeapError;
|
||||
/* 0x78 */ s32 mCurrentHeapError;
|
||||
|
||||
public:
|
||||
static void* start(void* param_1);
|
||||
@@ -78,6 +124,9 @@ public:
|
||||
// static u8 sThreadList[12];
|
||||
};
|
||||
|
||||
typedef void (*JKRThreadSwitch_PreCallback)(OSThread* current, OSThread* next);
|
||||
typedef void (*JKRThreadSwitch_PostCallback)(OSThread* current, OSThread* next);
|
||||
|
||||
class JKRThreadSwitch {
|
||||
public:
|
||||
JKRThreadSwitch(JKRHeap*);
|
||||
@@ -90,22 +139,26 @@ public:
|
||||
JKRThread* enter(JKRThread* param_1, int param_2);
|
||||
static void callback(OSThread* param_1, OSThread* param_2);
|
||||
|
||||
// TODO: fix types
|
||||
static u8 sManager[4];
|
||||
static u8 sTotalCount[4];
|
||||
static u8 sTotalStart[4];
|
||||
static u8 mUserPreCallback[4];
|
||||
static u8 mUserPostCallback[4];
|
||||
static u32 getTotalCount() { return sTotalCount; }
|
||||
|
||||
public:
|
||||
JKRHeap* heap;
|
||||
u8 field_0x8[4];
|
||||
u32 field_0xC[2];
|
||||
u8 field_0x14[4];
|
||||
u32 field_0x18;
|
||||
u32 field_0x1C;
|
||||
u32 field_0x20;
|
||||
u32 field_0x24;
|
||||
private:
|
||||
static JKRThreadSwitch* sManager;
|
||||
static u32 sTotalCount;
|
||||
static u32 sTotalStart;
|
||||
static JKRThreadSwitch_PreCallback mUserPreCallback;
|
||||
static JKRThreadSwitch_PostCallback mUserPostCallback;
|
||||
|
||||
private:
|
||||
/* 0x00 */ // vtable
|
||||
/* 0x04 */ JKRHeap* mHeap;
|
||||
/* 0x08 */ bool mSetNextHeap;
|
||||
/* 0x09 */ u8 field_0x9[3];
|
||||
/* 0x0C */ u32 field_0xC;
|
||||
/* 0x10 */ u32 field_0x10;
|
||||
/* 0x14 */ u8 field_0x14[4];
|
||||
/* 0x18 */ s64 field_0x18;
|
||||
/* 0x20 */ u32 field_0x20;
|
||||
/* 0x24 */ u32 field_0x24;
|
||||
};
|
||||
|
||||
struct JKRTask {
|
||||
|
||||
@@ -3,6 +3,26 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
#if DEBUG
|
||||
#define JUT_ASSERT(FILE, LINE, COND) \
|
||||
if (!COND) { \
|
||||
JUTAssertion::showAssert(JUTAssertion::getSDevice(), FILE, LINE, #COND); \
|
||||
OSPanic(FILE, LINE, "Halt"); \
|
||||
}
|
||||
|
||||
#else
|
||||
#define JUT_ASSERT(...)
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
#define JUT_PANIC(FILE, LINE, TEXT) \
|
||||
JUTAssertion::showAssert(JUTAssertion::getSDevice(), FILE, LINE, TEXT); \
|
||||
OSPanic(FILE, LINE, "Halt");
|
||||
|
||||
#else
|
||||
#define JUT_PANIC(...)
|
||||
#endif
|
||||
|
||||
// TODO: make it a namespace
|
||||
struct JUTAssertion {
|
||||
/* 802E495C */ static void create();
|
||||
|
||||
@@ -141,7 +141,7 @@ s32 OSResumeThread(OSThread* thread);
|
||||
void OSExitThread(void* exit_val);
|
||||
bool OSIsThreadSuspended(OSThread* thread);
|
||||
BOOL OSIsThreadTerminated(OSThread* thread);
|
||||
OSSwitchThreadCallback OSSetSwitchThreadCallback(OSSwitchThreadCallback* callback);
|
||||
OSSwitchThreadCallback OSSetSwitchThreadCallback(OSSwitchThreadCallback callback);
|
||||
|
||||
void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* messages, int message_count);
|
||||
BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* message, int flags);
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#define IS_ALIGNED(X, N) (((X) & ((N)-1)) == 0)
|
||||
#define IS_NOT_ALIGNED(X, N) (((X) & ((N)-1)) != 0)
|
||||
|
||||
#define JUT_ASSERT(...)
|
||||
#define JUT_EXPECT(...)
|
||||
#define ASSERT(...)
|
||||
#define LOGF(FMT, ...)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JKernel/JKRDvdFile.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include "dol2asm.h"
|
||||
#include "global.h"
|
||||
@@ -100,7 +101,12 @@ void JKRDvdFile::close() {
|
||||
|
||||
/* 802D99B4-802D9A68 2D42F4 00B4+00 1/0 0/0 0/0 .text readData__10JKRDvdFileFPvll */
|
||||
s32 JKRDvdFile::readData(void* param_1, long length, long param_3) {
|
||||
JUT_ASSERT((length & 0x1f) == 0);
|
||||
/* clang-format off */
|
||||
// The assert condition gets stringified as "( length & 0x1f ) == 0",
|
||||
// with out disabling clang-format the spaces in the condition will
|
||||
// get removed and the string will be incorrect.
|
||||
JUT_ASSERT("JKRDvdFile.cpp", 0xee, ( length & 0x1f ) == 0);
|
||||
/* clang-format on */
|
||||
|
||||
OSLockMutex(&mMutex1);
|
||||
if (mOSThread) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include "dol2asm.h"
|
||||
#include "global.h"
|
||||
@@ -604,14 +605,14 @@ void operator delete[](void* ptr) {
|
||||
/* 802CED84-802CED88 2C96C4 0004+00 1/0 1/0 0/0 .text
|
||||
* state_register__7JKRHeapCFPQ27JKRHeap6TStateUl */
|
||||
void JKRHeap::state_register(JKRHeap::TState* p, u32 id) const {
|
||||
JUT_ASSERT(p != 0);
|
||||
JUT_ASSERT(p->getHeap() == this);
|
||||
JUT_ASSERT("JKRHeap.cpp", 0x4bd, p != 0);
|
||||
JUT_ASSERT("JKRHeap.cpp", 0x4be, p->getHeap() == this);
|
||||
}
|
||||
|
||||
/* 802CED88-802CEDA0 2C96C8 0018+00 1/0 1/0 0/0 .text
|
||||
* state_compare__7JKRHeapCFRCQ27JKRHeap6TStateRCQ27JKRHeap6TState */
|
||||
bool JKRHeap::state_compare(JKRHeap::TState const& r1, JKRHeap::TState const& r2) const {
|
||||
JUT_ASSERT(r1.getHeap() == r2.getHeap());
|
||||
JUT_ASSERT("JKRHeap.cpp", 0x4c6, r1.getHeap() == r2.getHeap());
|
||||
return r1.getCheckCode() == r2.getCheckCode();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dol2asm.h"
|
||||
#include "global.h"
|
||||
#include "msl_c/math.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
@@ -156,10 +158,14 @@ asm s32 JKRSolidHeap::adjustSize() {
|
||||
|
||||
/* 802D0CB0-802D0D58 2CB5F0 00A8+00 1/0 0/0 0/0 .text do_alloc__12JKRSolidHeapFUli */
|
||||
void* JKRSolidHeap::do_alloc(u32 size, int alignment) {
|
||||
#if DEBUG
|
||||
// TODO(Julgodis): JUTAssertion::setConfirmMessage
|
||||
if (alignment != 0) {
|
||||
JUT_ASSERT(abs(alignment));
|
||||
JUT_ASSERT(isPower2(alignment));
|
||||
int u = abs(alignment);
|
||||
JUT_ASSERT("JKRSolidHeap.cpp", 0xdb, u < 0x80);
|
||||
JUT_ASSERT("JKRSolidHeap.cpp", 0xdc, JGadget::binary::isPower2(u));
|
||||
}
|
||||
#endif
|
||||
|
||||
lock();
|
||||
|
||||
@@ -348,8 +354,8 @@ bool JKRSolidHeap::dump(void) {
|
||||
// full match expect using the wrong register
|
||||
#ifdef NONMATCHING
|
||||
void JKRSolidHeap::state_register(JKRHeap::TState* p, u32 id) const {
|
||||
JUT_ASSERT(p != 0);
|
||||
JUT_ASSERT(p->getHeap() == this);
|
||||
JUT_ASSERT("JKRSolidHeap.cpp", 0x25c, p != 0);
|
||||
JUT_ASSERT("JKRSolidHeap.cpp", 0x25d, p->getHeap() == this);
|
||||
|
||||
getState_(p);
|
||||
setState_u32ID_(p, id);
|
||||
@@ -370,7 +376,7 @@ asm void JKRSolidHeap::state_register(JKRHeap::TState* param_0, u32 param_1) con
|
||||
/* 802D1258-802D1288 2CBB98 0030+00 1/0 0/0 0/0 .text
|
||||
* state_compare__12JKRSolidHeapCFRCQ27JKRHeap6TStateRCQ27JKRHeap6TState */
|
||||
bool JKRSolidHeap::state_compare(JKRHeap::TState const& r1, JKRHeap::TState const& r2) const {
|
||||
JUT_ASSERT(r1.getHeap() == r2.getHeap());
|
||||
JUT_ASSERT("JKRSolidHeap.cpp", 0x278, r1.getHeap() == r2.getHeap());
|
||||
|
||||
bool result = true;
|
||||
if (r1.getCheckCode() != r2.getCheckCode()) {
|
||||
|
||||
+186
-185
@@ -5,8 +5,10 @@
|
||||
|
||||
#include "JSystem/JKernel/JKRThread.h"
|
||||
#include "JSystem/JKernel/JKRExpHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "msl_c/string.h"
|
||||
|
||||
//
|
||||
// Types:
|
||||
@@ -18,92 +20,40 @@ struct JUTConsole {
|
||||
/* 802E7C38 */ void print(char const*);
|
||||
};
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern "C" void __ct__9JKRThreadFUlii();
|
||||
extern "C" void __ct__9JKRThreadFP7JKRHeapUlii();
|
||||
extern "C" void __ct__9JKRThreadFP8OSThreadi();
|
||||
extern "C" void __dt__9JKRThreadFv();
|
||||
extern "C" void setCommon_mesgQueue__9JKRThreadFP7JKRHeapi();
|
||||
extern "C" void setCommon_heapSpecified__9JKRThreadFP7JKRHeapUli();
|
||||
extern "C" void start__9JKRThreadFPv();
|
||||
extern "C" void searchThread__9JKRThreadFP8OSThread();
|
||||
extern "C" void __ct__15JKRThreadSwitchFP7JKRHeap();
|
||||
extern "C" void createManager__15JKRThreadSwitchFP7JKRHeap();
|
||||
extern "C" void enter__15JKRThreadSwitchFP9JKRThreadi();
|
||||
extern "C" void callback__15JKRThreadSwitchFP8OSThreadP8OSThread();
|
||||
extern "C" void draw__15JKRThreadSwitchFP14JKRThreadName_P10JUTConsole();
|
||||
extern "C" bool run__9JKRThreadFv();
|
||||
extern "C" void draw__15JKRThreadSwitchFP14JKRThreadName_();
|
||||
extern "C" void __dt__15JKRThreadSwitchFv();
|
||||
extern "C" void __sinit_JKRThread_cpp();
|
||||
extern "C" void func_802D1EFC(void* _this);
|
||||
extern "C" void func_802D1F50(void* _this);
|
||||
extern "C" extern char const* const JKRThread__stringBase0;
|
||||
extern "C" u8 sThreadList__9JKRThread[12];
|
||||
extern "C" u8 sTaskList__7JKRTask[12];
|
||||
extern "C" u8 sEndMesgQueue__7JKRTask[32];
|
||||
extern "C" u8 sManager__15JKRThreadSwitch[4];
|
||||
extern "C" u8 sTotalCount__15JKRThreadSwitch[4];
|
||||
extern "C" u8 sTotalStart__15JKRThreadSwitch[4];
|
||||
extern "C" u8 mUserPreCallback__15JKRThreadSwitch[4];
|
||||
extern "C" u8 mUserPostCallback__15JKRThreadSwitch[4];
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
extern "C" void becomeCurrentHeap__7JKRHeapFv();
|
||||
extern "C" void alloc__7JKRHeapFUliP7JKRHeap();
|
||||
extern "C" void free__7JKRHeapFPvP7JKRHeap();
|
||||
extern "C" void findFromRoot__7JKRHeapFPv();
|
||||
extern "C" void isSubHeap__7JKRHeapCFP7JKRHeap();
|
||||
extern "C" void* __nw__FUlP7JKRHeapi();
|
||||
extern "C" void __dl__FPv();
|
||||
extern "C" void __ct__11JKRDisposerFv();
|
||||
extern "C" void __dt__11JKRDisposerFv();
|
||||
extern "C" void __ct__10JSUPtrLinkFPv();
|
||||
extern "C" void __dt__10JSUPtrLinkFv();
|
||||
extern "C" void __ct__10JSUPtrListFb();
|
||||
extern "C" void __dt__10JSUPtrListFv();
|
||||
extern "C" void initiate__10JSUPtrListFv();
|
||||
extern "C" void append__10JSUPtrListFP10JSUPtrLink();
|
||||
extern "C" void remove__10JSUPtrListFP10JSUPtrLink();
|
||||
extern "C" void clear__10JUTConsoleFv();
|
||||
extern "C" void print_f__10JUTConsoleFPCce();
|
||||
extern "C" void print__10JUTConsoleFPCc();
|
||||
extern "C" void JUTWarningConsole();
|
||||
extern "C" void __register_global_object();
|
||||
extern "C" void __cvt_fp2unsigned();
|
||||
extern "C" void _savegpr_25();
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _savegpr_28();
|
||||
extern "C" void _savegpr_29();
|
||||
extern "C" void _restgpr_25();
|
||||
extern "C" void _restgpr_27();
|
||||
extern "C" void _restgpr_28();
|
||||
extern "C" void _restgpr_29();
|
||||
extern "C" void __cvt_sll_flt();
|
||||
extern "C" void sprintf();
|
||||
extern "C" u8 sSystemHeap__7JKRHeap[4];
|
||||
extern "C" u8 sCurrentHeap__7JKRHeap[4];
|
||||
extern "C" u8 sRootHeap__7JKRHeap[4];
|
||||
extern "C" void* __vt__15JKRThreadSwitch;
|
||||
extern "C" void JUTWarningConsole(const char*);
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 8043428C-80434298 060FAC 000C+00 5/6 0/0 0/0 .bss sThreadList__9JKRThread */
|
||||
JSUList<JKRThread> JKRThread::sThreadList(0);
|
||||
|
||||
/* 804513B0-804513B4 0008B0 0004+00 2/2 1/1 0/0 .sbss sManager__15JKRThreadSwitch */
|
||||
JKRThreadSwitch* JKRThreadSwitch::sManager;
|
||||
|
||||
/* 804513B4-804513B8 0008B4 0004+00 3/3 0/0 0/0 .sbss sTotalCount__15JKRThreadSwitch */
|
||||
u32 JKRThreadSwitch::sTotalCount;
|
||||
|
||||
/* 804513B8-804513BC 0008B8 0004+00 1/1 0/0 0/0 .sbss sTotalStart__15JKRThreadSwitch */
|
||||
u32 JKRThreadSwitch::sTotalStart;
|
||||
|
||||
/* 804513BC-804513C0 0008BC 0004+00 1/1 0/0 0/0 .sbss None */
|
||||
static u32 data_804513BC;
|
||||
|
||||
/* 804513C0-804513C4 0008C0 0004+00 1/1 0/0 0/0 .sbss mUserPreCallback__15JKRThreadSwitch
|
||||
*/
|
||||
JKRThreadSwitch_PreCallback JKRThreadSwitch::mUserPreCallback;
|
||||
|
||||
/* 804513C4-804513C8 0008C4 0004+00 1/1 0/0 0/0 .sbss mUserPostCallback__15JKRThreadSwitch */
|
||||
JKRThreadSwitch_PostCallback JKRThreadSwitch::mUserPostCallback;
|
||||
|
||||
/* 802D1568-802D1610 2CBEA8 00A8+00 0/0 4/4 0/0 .text __ct__9JKRThreadFUlii */
|
||||
JKRThread::JKRThread(u32 stack_size, int message_count, int param_3) : mThreadListLink(this) {
|
||||
mSwitchCount = 0;
|
||||
mCost = 0;
|
||||
field_0x6c = 0;
|
||||
field_0x60 = 0;
|
||||
field_0x70 = 0;
|
||||
|
||||
JKRHeap* heap = JKRHeap::findFromRoot(this);
|
||||
if (heap == NULL) {
|
||||
heap = JKRHeap::getSystemHeap();
|
||||
@@ -116,12 +66,6 @@ JKRThread::JKRThread(u32 stack_size, int message_count, int param_3) : mThreadLi
|
||||
/* 802D1610-802D16B8 2CBF50 00A8+00 0/0 2/2 0/0 .text __ct__9JKRThreadFP7JKRHeapUlii */
|
||||
JKRThread::JKRThread(JKRHeap* heap, u32 stack_size, int message_count, int param_4)
|
||||
: mThreadListLink(this) {
|
||||
mSwitchCount = 0;
|
||||
mCost = 0;
|
||||
field_0x6c = 0;
|
||||
field_0x60 = 0;
|
||||
field_0x70 = 0;
|
||||
|
||||
if (heap == NULL) {
|
||||
heap = JKRHeap::getCurrentHeap();
|
||||
}
|
||||
@@ -132,11 +76,6 @@ JKRThread::JKRThread(JKRHeap* heap, u32 stack_size, int message_count, int param
|
||||
|
||||
/* 802D16B8-802D1758 2CBFF8 00A0+00 0/0 5/5 0/0 .text __ct__9JKRThreadFP8OSThreadi */
|
||||
JKRThread::JKRThread(OSThread* thread, int message_count) : mThreadListLink(this) {
|
||||
mSwitchCount = 0;
|
||||
mCost = 0;
|
||||
field_0x6c = 0;
|
||||
field_0x60 = 0;
|
||||
field_0x70 = 0;
|
||||
mHeap = NULL;
|
||||
mThreadRecord = thread;
|
||||
mStackSize = (u32)thread->stack_end - (u32)thread->stack_base;
|
||||
@@ -145,9 +84,6 @@ JKRThread::JKRThread(OSThread* thread, int message_count) : mThreadListLink(this
|
||||
setCommon_mesgQueue(JKRHeap::getSystemHeap(), message_count);
|
||||
}
|
||||
|
||||
/* 8043428C-80434298 060FAC 000C+00 5/6 0/0 0/0 .bss sThreadList__9JKRThread */
|
||||
JSUList<JKRThread> JKRThread::sThreadList(0);
|
||||
|
||||
/* 802D1758-802D1830 2CC098 00D8+00 1/0 9/9 0/0 .text __dt__9JKRThreadFv */
|
||||
JKRThread::~JKRThread() {
|
||||
getList().remove(&mThreadListLink);
|
||||
@@ -209,50 +145,52 @@ JKRThread* JKRThread::searchThread(OSThread* thread) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804513B0-804513B4 0008B0 0004+00 2/2 1/1 0/0 .sbss sManager__15JKRThreadSwitch */
|
||||
u8 JKRThreadSwitch::sManager[4];
|
||||
|
||||
/* 804513B4-804513B8 0008B4 0004+00 3/3 0/0 0/0 .sbss sTotalCount__15JKRThreadSwitch */
|
||||
u8 JKRThreadSwitch::sTotalCount[4];
|
||||
|
||||
/* 804513B8-804513BC 0008B8 0004+00 1/1 0/0 0/0 .sbss sTotalStart__15JKRThreadSwitch */
|
||||
u8 JKRThreadSwitch::sTotalStart[4];
|
||||
|
||||
/* 804513BC-804513C0 0008BC 0004+00 1/1 0/0 0/0 .sbss None */
|
||||
static u8 data_804513BC[4];
|
||||
|
||||
/* 802D199C-802D1A14 2CC2DC 0078+00 1/1 0/0 0/0 .text __ct__15JKRThreadSwitchFP7JKRHeap
|
||||
*/
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm JKRThreadSwitch::JKRThreadSwitch(JKRHeap* param_0) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/__ct__15JKRThreadSwitchFP7JKRHeap.s"
|
||||
JKRThreadSwitch::JKRThreadSwitch(JKRHeap* param_0) {
|
||||
mHeap = param_0;
|
||||
OSSetSwitchThreadCallback(JKRThreadSwitch::callback);
|
||||
this->field_0xC = 0;
|
||||
this->field_0x10 = 1;
|
||||
this->field_0x18 = 0;
|
||||
sTotalCount = 0;
|
||||
data_804513BC = 0;
|
||||
sTotalStart = 0;
|
||||
this->field_0x20 = 0;
|
||||
this->field_0x24 = 0;
|
||||
mSetNextHeap = true;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802D1A14-802D1A70 2CC354 005C+00 0/0 1/1 0/0 .text createManager__15JKRThreadSwitchFP7JKRHeap
|
||||
*/
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm JKRThreadSwitch* JKRThreadSwitch::createManager(JKRHeap* param_0) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/createManager__15JKRThreadSwitchFP7JKRHeap.s"
|
||||
JKRThreadSwitch* JKRThreadSwitch::createManager(JKRHeap* heap) {
|
||||
JUT_ASSERT("JKRThread.cpp", 0x157, sManager == 0);
|
||||
|
||||
if (!heap) {
|
||||
heap = JKRGetCurrentHeap();
|
||||
}
|
||||
|
||||
sManager = new (heap, 0) JKRThreadSwitch(heap);
|
||||
return sManager;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802D1A70-802D1AE4 2CC3B0 0074+00 0/0 1/1 0/0 .text enter__15JKRThreadSwitchFP9JKRThreadi */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm JKRThread* JKRThreadSwitch::enter(JKRThread* param_0, int param_1) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/enter__15JKRThreadSwitchFP9JKRThreadi.s"
|
||||
JKRThread* JKRThreadSwitch::enter(JKRThread* thread, int thread_id) {
|
||||
if (!thread) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JKRThread* found_thread = JKRThread::searchThread(thread->getThreadRecord());
|
||||
if (found_thread) {
|
||||
thread = found_thread;
|
||||
}
|
||||
|
||||
JKRThread::TLoad* loadInfo = thread->getLoadInfo();
|
||||
loadInfo->clear();
|
||||
loadInfo->setValid(true);
|
||||
loadInfo->setId(thread_id);
|
||||
return thread;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8039CFA8-8039CFA8 029608 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
|
||||
@@ -262,61 +200,137 @@ SECTION_DEAD static char const* const stringBase_8039CFA8 = "on";
|
||||
SECTION_DEAD static char const* const stringBase_8039CFAB = "off";
|
||||
SECTION_DEAD static char const* const stringBase_8039CFAF =
|
||||
"JKRThread:%x OSThread:%x Load:ID:%d (%s)\n";
|
||||
SECTION_DEAD static char const* const stringBase_8039CFDC =
|
||||
"JKRThreadSwitch: currentHeap destroyed.\n";
|
||||
#pragma pop
|
||||
|
||||
/* 804513C0-804513C4 0008C0 0004+00 1/1 0/0 0/0 .sbss mUserPreCallback__15JKRThreadSwitch
|
||||
*/
|
||||
u8 JKRThreadSwitch::mUserPreCallback[4];
|
||||
|
||||
/* 804513C4-804513C8 0008C4 0004+00 1/1 0/0 0/0 .sbss mUserPostCallback__15JKRThreadSwitch */
|
||||
u8 JKRThreadSwitch::mUserPostCallback[4];
|
||||
|
||||
/* 802D1AE4-802D1C74 2CC424 0190+00 1/1 0/0 0/0 .text
|
||||
* callback__15JKRThreadSwitchFP8OSThreadP8OSThread */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void JKRThreadSwitch::callback(OSThread* param_0, OSThread* param_1) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/callback__15JKRThreadSwitchFP8OSThreadP8OSThread.s"
|
||||
void JKRThreadSwitch::callback(OSThread* current, OSThread* next) {
|
||||
if (mUserPreCallback) {
|
||||
(*mUserPreCallback)(current, next);
|
||||
}
|
||||
|
||||
sTotalCount = sTotalCount + 1;
|
||||
|
||||
JKRHeap* next_heap = NULL;
|
||||
JSUList<JKRThread>& threadList = JKRThread::getList();
|
||||
JSUListIterator<JKRThread> iterator;
|
||||
for (iterator = threadList.getFirst(); iterator != threadList.getEnd(); ++iterator) {
|
||||
JKRThread* thread = iterator.getObject();
|
||||
|
||||
if (thread->getThreadRecord() == current) {
|
||||
thread->setCurrentHeap(JKRHeap::getCurrentHeap());
|
||||
JKRThread::TLoad* loadInfo = thread->getLoadInfo();
|
||||
if (loadInfo->isValid()) {
|
||||
loadInfo->addCurrentCost();
|
||||
}
|
||||
}
|
||||
|
||||
if (thread->getThreadRecord() == next) {
|
||||
JKRThread::TLoad* loadInfo = thread->getLoadInfo();
|
||||
if (loadInfo->isValid()) {
|
||||
loadInfo->setCurrentTime();
|
||||
loadInfo->incCount();
|
||||
}
|
||||
|
||||
if (sManager->mSetNextHeap) {
|
||||
next_heap = thread->getCurrentHeap();
|
||||
if (!next_heap) {
|
||||
next_heap = JKRHeap::getCurrentHeap();
|
||||
} else if (JKRHeap::getRootHeap()->isSubHeap(next_heap)) {
|
||||
continue;
|
||||
#if DEBUG
|
||||
} else if (!JKRHeap::getRootHeap2()->isSubHeap(next_heap)) {
|
||||
continue;
|
||||
#endif
|
||||
} else {
|
||||
switch (thread->getCurrentHeapError()) {
|
||||
case 0:
|
||||
JUT_PANIC("JKRThread.cpp", 0x1fc,
|
||||
"JKRThreadSwitch: currentHeap destroyed.");
|
||||
break;
|
||||
case 1:
|
||||
JUTWarningConsole("JKRThreadSwitch: currentHeap destroyed.\n");
|
||||
next_heap = JKRHeap::getCurrentHeap();
|
||||
break;
|
||||
case 2:
|
||||
next_heap = JKRHeap::getCurrentHeap();
|
||||
break;
|
||||
case 3:
|
||||
next_heap = JKRHeap::getSystemHeap();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (next_heap) {
|
||||
next_heap->becomeCurrentHeap();
|
||||
}
|
||||
|
||||
if (mUserPostCallback) {
|
||||
(*mUserPostCallback)(current, next);
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8039CFA8-8039CFA8 029608 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
SECTION_DEAD static char const* const stringBase_8039D005 = " total: switch:%3d time:%d(%df)\n";
|
||||
SECTION_DEAD static char const* const stringBase_8039D027 =
|
||||
" -------------------------------------\n";
|
||||
SECTION_DEAD static char const* const stringBase_8039D04F = "%d";
|
||||
SECTION_DEAD static char const* const stringBase_8039D052 = " [%10s] switch:%5d cost:%2d.%d%%\n";
|
||||
/* @stringBase0 padding */
|
||||
SECTION_DEAD static char const* const pad_8039D075 = "\0\0";
|
||||
#pragma pop
|
||||
|
||||
/* 80455FC0-80455FC4 0045C0 0004+00 1/1 0/0 0/0 .sdata2 @934 */
|
||||
SECTION_SDATA2 static f32 lit_934 = 100.0f;
|
||||
|
||||
/* 80455FC4-80455FC8 0045C4 0004+00 1/1 0/0 0/0 .sdata2 @935 */
|
||||
SECTION_SDATA2 static f32 lit_935 = 1000.0f;
|
||||
|
||||
/* 80455FC8-80455FD0 0045C8 0008+00 1/1 0/0 0/0 .sdata2 @937 */
|
||||
SECTION_SDATA2 static f64 lit_937 = 4503599627370496.0 /* cast u32 to float */;
|
||||
|
||||
/* 802D1C74-802D1E14 2CC5B4 01A0+00 1/0 0/0 0/0 .text
|
||||
* draw__15JKRThreadSwitchFP14JKRThreadName_P10JUTConsole */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
#pragma force_active on
|
||||
asm void JKRThreadSwitch::draw(JKRThreadName_* param_0, JUTConsole* param_1) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/draw__15JKRThreadSwitchFP14JKRThreadName_P10JUTConsole.s"
|
||||
void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console) {
|
||||
const char* print_0 = " total: switch:%3d time:%d(%df)\n";
|
||||
const char* print_1 = " -------------------------------------\n";
|
||||
|
||||
if (!console) {
|
||||
#if DEBUG
|
||||
OSReport(print_0, getTotalCount(), (int)this->field_0x18, this->field_0x10);
|
||||
OSReport(print_1);
|
||||
#endif
|
||||
} else {
|
||||
console->clear();
|
||||
console->print_f(print_0, getTotalCount(), (int)this->field_0x18, this->field_0x10);
|
||||
console->print(print_1);
|
||||
}
|
||||
|
||||
JSUList<JKRThread>& threadList = JKRThread::getList();
|
||||
JSUListIterator<JKRThread> iterator;
|
||||
for (iterator = threadList.getFirst(); iterator != threadList.getEnd(); ++iterator) {
|
||||
JKRThread* thread = iterator.getObject();
|
||||
JKRThread::TLoad* loadInfo = thread->getLoadInfo();
|
||||
|
||||
if (loadInfo->isValid()) {
|
||||
char* thread_print_name = NULL;
|
||||
if (thread_name_list) {
|
||||
JKRThreadName_* thread_name = thread_name_list;
|
||||
for (; thread_name->name; thread_name++) {
|
||||
if (thread_name->id == loadInfo->getId()) {
|
||||
thread_print_name = thread_name->name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!thread_print_name) {
|
||||
char buffer[16];
|
||||
sprintf(buffer, "%d", loadInfo->getId());
|
||||
thread_print_name = buffer;
|
||||
}
|
||||
|
||||
u32 switch_count = loadInfo->getCount();
|
||||
float cost_per_0x18 = loadInfo->getCost() / (float)this->field_0x18;
|
||||
|
||||
u32 cost_int = (u32)(cost_per_0x18 * 100.0f);
|
||||
u32 cost_float = (u32)(cost_per_0x18 * 1000.0f) % 10;
|
||||
if (!console) {
|
||||
#if DEBUG
|
||||
OSReport(" [%10s] switch:%5d cost:%2d.%d%%\n", thread_print_name, switch_count,
|
||||
cost_int, cost_float);
|
||||
#endif
|
||||
} else {
|
||||
console->print_f(" [%10s] switch:%5d cost:%2d.%d%%\n", thread_print_name,
|
||||
switch_count, cost_int, cost_float);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802D1E14-802D1E1C 2CC754 0008+00 1/0 0/0 0/0 .text run__9JKRThreadFv */
|
||||
void* JKRThread::run() {
|
||||
@@ -324,25 +338,12 @@ void* JKRThread::run() {
|
||||
}
|
||||
|
||||
/* 802D1E1C-802D1E4C 2CC75C 0030+00 1/0 0/0 0/0 .text draw__15JKRThreadSwitchFP14JKRThreadName_ */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
#pragma force_active on
|
||||
asm void JKRThreadSwitch::draw(JKRThreadName_* param_0) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/draw__15JKRThreadSwitchFP14JKRThreadName_.s"
|
||||
void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list) {
|
||||
draw(thread_name_list, NULL);
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802D1E4C-802D1E94 2CC78C 0048+00 1/0 0/0 0/0 .text __dt__15JKRThreadSwitchFv */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm JKRThreadSwitch::~JKRThreadSwitch() {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/__dt__15JKRThreadSwitchFv.s"
|
||||
}
|
||||
#pragma pop
|
||||
JKRThreadSwitch::~JKRThreadSwitch() {}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80434298-804342A4 060FB8 000C+00 0/1 0/0 0/0 .bss @989 */
|
||||
|
||||
@@ -215,7 +215,10 @@ def load_object_from_file(path, name, file) -> Object:
|
||||
relocation = R_PPC_REL14(type, symbol, modify, rela.r_offset, rela.r_addend)
|
||||
elif type == 109:
|
||||
relocation = R_PPC_EMB_SDA21(type, symbol, modify, rela.r_offset, rela.r_addend)
|
||||
|
||||
else:
|
||||
print("unsupported relocation type: 0x%02X \"%s\" (in '%s')" % (type, RELOCATION_NAMES[type], path), file = sys.stderr)
|
||||
continue
|
||||
|
||||
assert relocation
|
||||
section_relocations.append(relocation)
|
||||
obj.relocations.append(relocation)
|
||||
|
||||
@@ -77,6 +77,7 @@ RELOCATION_NAMES = {
|
||||
0x6: "R_PPC_ADDR16_HA",
|
||||
0xA: "R_PPC_REL24",
|
||||
0xB: "R_PPC_REL14",
|
||||
0x18: "R_PPC_UADDR32",
|
||||
0x6D: "R_PPC_EMB_SDA21",
|
||||
}
|
||||
|
||||
|
||||
+9
-8
@@ -412,7 +412,7 @@ def pull_request(debug, thread_count, game_path, build_path):
|
||||
text.stylize("bold magenta")
|
||||
CONSOLE.print(text)
|
||||
|
||||
calculate_progress(True, "FANCY")
|
||||
calculate_progress(True, "FANCY", False)
|
||||
|
||||
|
||||
def find_all_asm_files():
|
||||
@@ -649,9 +649,9 @@ class CheckException(Exception):
|
||||
|
||||
def check_sha1(game_path, build_path):
|
||||
|
||||
dol_path = game_path.joinpath("main.dol")
|
||||
if not dol_path.exists():
|
||||
raise CheckException(f"File not found: '{dol_path}'")
|
||||
#dol_path = game_path.joinpath("main.dol")
|
||||
#if not dol_path.exists():
|
||||
# raise CheckException(f"File not found: '{dol_path}'")
|
||||
|
||||
rel_path = game_path.joinpath("rel/Final/Release")
|
||||
if not rel_path.exists():
|
||||
@@ -662,14 +662,15 @@ def check_sha1(game_path, build_path):
|
||||
if not rels_archive_path.exists():
|
||||
raise CheckException(f"File not found: '{rels_archive_path}'")
|
||||
|
||||
LOG.debug(f"DOL Path: '{dol_path}'")
|
||||
#LOG.debug(f"DOL Path: '{dol_path}'")
|
||||
LOG.debug(f"RELs Path: '{rel_path}' (found {len(rels_path)} RELs)")
|
||||
LOG.debug(f"RELs Archive Path: '{rels_archive_path}'")
|
||||
|
||||
EXPECTED = {}
|
||||
with dol_path.open('rb') as file:
|
||||
data = file.read()
|
||||
EXPECTED[0] = (str(dol_path), sha1_from_data(data),sha1_from_data(data),)
|
||||
#with dol_path.open('rb') as file:
|
||||
# data = file.read()
|
||||
# EXPECTED[0] = (str(dol_path), sha1_from_data(data),sha1_from_data(data),)
|
||||
EXPECTED[0] = ("", "4997D93B9692620C40E90374A0F1DBF0E4889395", "4997D93B9692620C40E90374A0F1DBF0E4889395",)
|
||||
|
||||
for rel_filepath in rels_path:
|
||||
with rel_filepath.open('rb') as file:
|
||||
|
||||
Reference in New Issue
Block a user