MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / iMemInit

Function iMemInit

src/SB/Core/gc/iMemMgr.cpp:19–49  ·  view source on GitHub ↗

Starts going wrong after the if and else statement, everything else before looks fine.

Source from the content-addressed store, hash-verified

17
18// Starts going wrong after the if and else statement, everything else before looks fine.
19void iMemInit()
20{
21 OSHeapHandle hi = (OSHeapHandle)OSGetArenaHi();
22 he = hi & 0xffffffe0;
23 hs = (OSHeapHandle)OSGetArenaLo() + 0x1f & 0xffffffe0;
24 the_heap = OSCreateHeap(OSInitAlloc((void*)hs, (void*)(hi & 0xffffffe0), 1), (void*)he);
25 OSHeapHandle currHeap = the_heap;
26 if (currHeap >= 0)
27 {
28 OSSetCurrentHeap(currHeap);
29 }
30 else
31 {
32 exit(-5);
33 }
34 gMemInfo.system.addr = 0;
35 gMemInfo.system.size = 0x100000;
36 gMemInfo.system.flags = 0x20;
37 gMemInfo.stack.addr = (U32)&_stack_addr;
38 gMemInfo.stack.size = 0xffff8000;
39 gMemInfo.stack.flags = gMemInfo.DRAM.flags = 0x820;
40 HeapSize = 0x384000;
41 gMemInfo.DRAM.addr = (U32)OSAllocFromHeap(__OSCurrHeap, 0x384000);
42 gMemInfo.DRAM.size = HeapSize;
43 gMemInfo.DRAM.flags = 0x820;
44 gMemInfo.SRAM.addr = 0;
45 gMemInfo.SRAM.size = 0x200000;
46 gMemInfo.SRAM.flags = 0x660;
47 mem_top_alloc = gMemInfo.DRAM.addr + HeapSize;
48 mem_base_alloc = gMemInfo.DRAM.addr;
49}
50
51void iMemExit()
52{

Callers 1

xMemInitFunction · 0.50

Calls 7

OSGetArenaHiFunction · 0.85
OSGetArenaLoFunction · 0.85
OSCreateHeapFunction · 0.85
OSInitAllocFunction · 0.85
OSSetCurrentHeapFunction · 0.85
exitFunction · 0.85
OSAllocFromHeapFunction · 0.85

Tested by

no test coverage detected