| 35 | } |
| 36 | |
| 37 | U32* iFileLoad(char* name, U32* buffer, U32* size) |
| 38 | { |
| 39 | char path[128]; |
| 40 | tag_xFile file; |
| 41 | S32 fileSize, alignedSize; |
| 42 | |
| 43 | iFileFullPath(name, path); |
| 44 | iFileOpen(name, IFILE_OPEN_ABSPATH, &file); |
| 45 | |
| 46 | fileSize = iFileGetSize(&file); |
| 47 | |
| 48 | if (!buffer) |
| 49 | { |
| 50 | buffer = (U32*)OSAlloc(OSRoundUp32B(fileSize)); |
| 51 | } |
| 52 | |
| 53 | alignedSize = OSRoundUp32B(fileSize); |
| 54 | |
| 55 | iFileRead(&file, buffer, alignedSize); |
| 56 | |
| 57 | if (size) |
| 58 | { |
| 59 | *size = alignedSize; |
| 60 | } |
| 61 | |
| 62 | iFileClose(&file); |
| 63 | |
| 64 | return buffer; |
| 65 | } |
| 66 | |
| 67 | U32 iFileOpen(const char* name, S32 flags, tag_xFile* file) |
| 68 | { |
no test coverage detected