1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-23 22:05:09 +00:00
oot/src/libultra_boot_O1/osGetMemSize.c

35 lines
533 B
C
Raw Normal View History

2020-03-17 04:31:30 +00:00
#include <global.h>
#define STEP 0x100000
u32 osGetMemSize(void)
{
u32* ptr;
u32 size;
u32 data0;
u32 data1;
size = 0x400000;
while(size < 0x800000)
{
ptr = (u32*)(0xA0000000 + size);
data0 = *ptr;
data1 = ptr[STEP/4-1];
*ptr ^= ~0;
ptr[STEP/4-1] ^= ~0;
if ((*ptr != (data0 ^ ~0)) || (ptr[STEP/4-1] != (data1 ^ ~0)))
return size;
*ptr = data0;
ptr[STEP/4-1] = data1;
size += STEP;
}
return size;
}