mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-30 14:16:02 +00:00
94eb2195d3
* Implemented a system updater homebrew (titled Daybreak) * git subrepo pull ./troposphere/daybreak/nanovg subrepo: subdir: "troposphere/daybreak/nanovg" merged: "c197ba2f" upstream: origin: "https://github.com/Adubbz/nanovg-deko.git" branch: "master" commit: "c197ba2f" git-subrepo: version: "0.4.1" origin: "???" commit: "???" (+1 squashed commits) Squashed commits: [232dc943] git subrepo clone https://github.com/Adubbz/nanovg-deko.git troposphere/daybreak/nanovg subrepo: subdir: "troposphere/daybreak/nanovg" merged: "52bb784b" upstream: origin: "https://github.com/Adubbz/nanovg-deko.git" branch: "master" commit: "52bb784b" git-subrepo: version: "0.4.1" origin: "???" commit: "???" * daybreak: switch to using hiddbg for home blocking (+1 squashed commits) Squashed commits: [4bfc7b0d] daybreak: block the home button during installation
27 lines
590 B
C++
27 lines
590 B
C++
/*
|
|
** Sample Framework for deko3d Applications
|
|
** FileLoader.cpp: Helpers for loading data from the filesystem directly into GPU memory
|
|
*/
|
|
#include "FileLoader.h"
|
|
|
|
CMemPool::Handle LoadFile(CMemPool& pool, const char* path, uint32_t alignment)
|
|
{
|
|
FILE *f = fopen(path, "rb");
|
|
if (!f) return nullptr;
|
|
|
|
fseek(f, 0, SEEK_END);
|
|
uint32_t fsize = ftell(f);
|
|
rewind(f);
|
|
|
|
CMemPool::Handle mem = pool.allocate(fsize, alignment);
|
|
if (!mem)
|
|
{
|
|
fclose(f);
|
|
return nullptr;
|
|
}
|
|
|
|
fread(mem.getCpuAddr(), fsize, 1, f);
|
|
fclose(f);
|
|
|
|
return mem;
|
|
}
|