diff options
| author | LagoLunatic <LagoLunatic@users.noreply.github.com> | 2025-12-26 19:20:21 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-26 16:20:21 -0800 |
| commit | 09280ae00bf6e457aa4694dbcb3f8388f702f3b9 (patch) | |
| tree | 05a1146271664c2d81756eaa162f11b4823ae1d0 /src/m_Do | |
| parent | 4ebf9fac9f21ffb7a0c9f33317001e83e82a39ac (diff) | |
Fix optimization flag for Shield (#3004)
* Fix optimization flag for Shield
* Minor debug work
* Fix NULL asserts
Diffstat (limited to 'src/m_Do')
| -rw-r--r-- | src/m_Do/m_Do_ext.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index f8c2d65728..228bc9f29f 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -831,17 +831,42 @@ u32 mDoExt_adjustSolidHeap(JKRSolidHeap* i_heap) { return -1; } + u32 estimatedSize = i_heap->getHeapSize(); s32 result = i_heap->adjustSize(); if (result < 0) { // "adjustSize failure %08x\n" OSReport_Error("adjustSize失敗 %08x\n", i_heap); return -1; } + u32 actualSize = i_heap->getHeapSize(); + + #if DEBUG + if (lbl_8074C3B9[0]) { + // "\x1B[33mSolid heap estimate: %08x actual: %08x\n\x1B[m" + OS_REPORT("\x1B[33mソリッドヒープの見積もり %08x 実際 %08x\n\x1B[m", estimatedSize, actualSize); + + if (estimatedSize > 0x400 && estimatedSize > (actualSize + 0x400)) { + // "\x1B[33mThe estimate is %x bytes too large (%5.2f times). This could lead to degraded memory efficiency.\n\x1B[m" + OS_REPORT("\x1B[33m見積もりが %x バイト大きい(%5.2f倍)です。メモリ効率悪化が懸念されます。\n\x1B[m", estimatedSize - actualSize, (f32)estimatedSize / (f32)actualSize); + } else if (estimatedSize >= (actualSize + 0x20)) { + // "\x1B[36mThe estimate is %x bytes too large. That's pretty good.\n\x1B[m" + OS_REPORT("\x1B[36m見積もりが %x バイト大きいです。だいぶいい感じです。\n\x1B[m", estimatedSize - actualSize); + } else { + // "\x1B[32mThe estimate is spot on! Perfect.\n\x1B[m" + OS_REPORT("\x1B[32m見積もりが、ジャストミート!完璧です。\n\x1B[m"); + } + } + + if (lbl_8074C3B9[0]) { + OS_REPORT("JKRSolidHeap::adjustSize %08x (%08x bytes)\n", (u32)i_heap, result); + } + #endif // this probably indicates that 0x80 is some constant, maybe from a sizeof(JKRSolidHeap) // with alignment? - if (result >= (u32)0x80) { - result -= 0x80; + u32 r25 = 0x80; + if (result >= r25) { + return result - r25; } return result; |
