mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-14 02:50:23 +00:00
Matched most remaining libultra files (#221)
* osPfsIsPlug.c and osContSetCh.c OK * update * __osPfsGetStatus.c OK * removed unused asm * Updated all libultra controller files to use new structs instead of the temporary structs. Added os_pfs.h * controller updates * fixed header guard * Made suggested changes * guLookAt.c OK * commit * __osPfsSelectBank.c OK * osPfsDeleteFile.c OK * pfsreadwritefile.c OK * osPfsFreeBlocks.c OK * cleaned up ospfsfreeblocks * started pfsinitpak.c * pfsallocatefile.c OK * contpfs.c decompiled with 1 non matching * osPfsFindFile.c OK * pfsinitpak.c decompiled. one non-matching * Actually fixed merge conflict * sins.c OK * cosf.c sinf.c and sins.c OK * moved osAfterPreNMI to its own file. Renamed code_801031F0 to contquery.c * pfschecker.c OK * final update and rename * Removed makefile testing thing that i accidentally added * Made suggested changes
This commit is contained in:
parent
e6ca2dfd70
commit
7e195a3562
59 changed files with 1769 additions and 3641 deletions
36
src/libultra_code/osPfsFreeBlocks.c
Normal file
36
src/libultra_code/osPfsFreeBlocks.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
#include <ultra64/pfs.h>
|
||||
|
||||
s32 osPfsFreeBlocks(OSPfs* pfs, s32* leftoverBytes) {
|
||||
s32 j;
|
||||
s32 pages = 0;
|
||||
__OSInode inode;
|
||||
s32 ret = 0;
|
||||
u8 bank;
|
||||
s32 offset;
|
||||
|
||||
if (!(pfs->status & PFS_INITIALIZED)) {
|
||||
return (PFS_ERR_INVALID);
|
||||
}
|
||||
|
||||
if ((ret = __osCheckId(pfs)) != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (bank = PFS_ID_BANK_256K; bank < pfs->banks; bank++) {
|
||||
if ((ret = __osPfsRWInode(pfs, &inode, PFS_READ, bank)) != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
offset = ((bank > PFS_ID_BANK_256K) ? 1 : pfs->inodeStartPage);
|
||||
for (j = offset; j < PFS_INODE_SIZE_PER_PAGE; j++) {
|
||||
if (inode.inodePage[j].ipage == PFS_PAGE_NOT_USED) {
|
||||
pages++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*leftoverBytes = pages * PFS_ONE_PAGE * BLOCKSIZE;
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue