Merge pull request #241 from TwilitRealm/double-heaps

Double heap sizes for various heaps (Midna eye)
This commit is contained in:
TakaRikka
2026-04-06 19:31:56 -07:00
committed by GitHub
8 changed files with 19 additions and 14 deletions
@@ -242,7 +242,7 @@ void J3DModelLoader::setupBBoardInfo() {
J3DMaterial* mesh = mpModelData->getJointNodePointer(i)->getMesh();
if (mesh != NULL) {
u32 shape_index = mesh->getShape()->getIndex();
u16* index_table = JSUConvertOffsetToPtr<u16>(mpShapeBlock,
BE(u16)* index_table = JSUConvertOffsetToPtr<BE(u16)>(mpShapeBlock,
(uintptr_t)mpShapeBlock->mpIndexTable);
J3DShapeInitData* shape_init_data =
JSUConvertOffsetToPtr<J3DShapeInitData>(mpShapeBlock,
+3
View File
@@ -40,6 +40,9 @@ void daAlink_c::setOriginalHeap(JKRExpHeap** i_ppheap, u32 i_size) {
u32 var_r29 = 0x90;
u32 var_r28 = 0x10;
u32 size = ROUND(i_size, 16);
#if TARGET_PC
size *= 2;
#endif
JKRHeap* parent = mDoExt_getGameHeap();
JKRExpHeap* heap = JKRExpHeap::create(size + (var_r29 + var_r28), parent, true);
+3 -4
View File
@@ -237,11 +237,7 @@ void* daPy_anmHeap_c::mallocBuffer() {
return mBuffer;
}
#if TARGET_PC
void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE i_heapType, const char* name) {
#else
void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE i_heapType, const char* name) {
#endif
u32 size;
if (i_heapType == 4) {
@@ -255,6 +251,9 @@ void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE i_heapType, con
} else {
size = 0xA0;
}
#if TARGET_PC
size *= 2;
#endif
char* tmpWork;
mDoExt_transAnmBas* tmpTransBas;
+2 -1
View File
@@ -6,6 +6,7 @@
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_k_wmark.h"
#include "dusk/memory.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "SSystem/SComponent/c_math.h"
#include "d/actor/d_a_player.h"
@@ -33,7 +34,7 @@ int dkWmark_c::create() {
mColorType = this->parameters;
}
mpHeap = mDoExt_createSolidHeapFromGameToCurrent(0x880, 0x20);
mpHeap = mDoExt_createSolidHeapFromGameToCurrent(HEAP_SIZE(0x880, 0x1100), 0x20);
if (mpHeap != NULL) {
JKRHEAP_NAME(mpHeap, "dkWmark_c::mpHeap");
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Alink", 0x23);
+2 -1
View File
@@ -1,6 +1,7 @@
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/d_kankyo.h"
#include "dusk/memory.h"
#ifdef __REVOLUTION_SDK__
#include <revolution.h>
#else
@@ -1175,7 +1176,7 @@ static void undwater_init() {
J3DModelData* modelData2 = (J3DModelData*)dComIfG_getObjectRes("Always", 0x1D);
JUT_ASSERT(1867, modelData2 != NULL);
g_env_light.undwater_ef_heap = mDoExt_createSolidHeapFromGameToCurrent(0x600, 0x20);
g_env_light.undwater_ef_heap = mDoExt_createSolidHeapFromGameToCurrent(HEAP_SIZE(0x600, 0xC00), 0x20);
JKRHEAP_NAME(g_env_light.undwater_ef_heap, "g_env_light.undwater_ef_heap");
if (g_env_light.undwater_ef_heap != NULL) {
+4
View File
@@ -1507,7 +1507,11 @@ void dMw_c::checkMemSize() {
OS_REPORT("memory check ===> diff ==> %d, start ==> %d, now ==> %d\n", diff, mMemSize, now_size);
#if TARGET_PC
if (diff > 0x40) {
#else
if (diff > 0x20) {
#endif
OSReport_Error("memory free error!!\n");
}
mMemSize = 0;
+1 -7
View File
@@ -393,13 +393,7 @@ static void dummy1(dStage_roomControl_c* roomControl) {
JKRExpHeap* dStage_roomControl_c::createMemoryBlock(int i_blockIdx, u32 i_heapSize) {
#if TARGET_PC
// Cave of Ordeals crashes around floor 29 due to no free heap space
// Increasing the size here avoids that, though its ugly. maybe TODO a better fix
if (strcmp(dComIfGp_getStartStageName(), "D_SB01") == 0) {
u32 prev = i_heapSize;
i_heapSize *= 2;
DuskLog.warn("Doubling heap size for D_SB01... ({}) -> ({})", prev, i_heapSize);
}
i_heapSize *= 2;
#endif
if (mMemoryBlock[i_blockIdx] == NULL) {
+3
View File
@@ -730,6 +730,9 @@ u8 var_r30 = fopAcM::HeapAdjustEntry;
#endif
u32 size = i_size & 0xFFFFFF;
#if TARGET_PC
size *= 2;
#endif
bool result = fopAcM_entrySolidHeap_(i_actor, i_heapCallback, size);
#if DEBUG
fopAcM::HeapDummyCheck = var_r29;