Fix missing includes and disable interrupts for pspSdkTotalFreeUserMemSize

This commit is contained in:
Steam Deck User
2023-04-13 21:36:52 -04:00
parent 0fa2a6ed12
commit 063e6f8a4e

View File

@@ -5,10 +5,14 @@
*
* memory.c - Code to get accurate reporting of available (video) memory.
*
* Copyright (c) 2023 Ivy Bowling <motolegacy.git@gmail.com>
* Copyright (c) 2023 Ivy Bowling <motolegacy@proton.me>
*
*/
#include <stdlib.h>
#include <stddef.h>
#include <pspsdk.h>
static u32 _pspSdkGetMaxLineareMemorySize(void)
{
u32 size, blocksize;
@@ -45,6 +49,8 @@ SceSize pspSdkTotalFreeUserMemSize(void)
ram = NULL;
size = count = 0;
int intc = pspSdkDisableInterrupts();
while (1)
{
/* Check entry size */
@@ -87,6 +93,8 @@ SceSize pspSdkTotalFreeUserMemSize(void)
free(ram);
}
pspSdkEnableInterrupts(intc);
/* Amount we were able to allocate before running out, in bytes. */
return size;
}