mirror of
https://github.com/switchbrew/switch-examples.git
synced 2025-06-22 05:42:39 +02:00
Official apps do this
This commit is contained in:
parent
b474b8b5bd
commit
a6072c5161
@ -35,15 +35,16 @@ int main(int argc, char **argv)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Make sure the sample buffer is aligned to 0x1000 bytes
|
// Make sure the sample buffer is aligned to 0x1000 bytes
|
||||||
u32 raw_data_size = ((SAMPLESPERBUF * BYTESPERSAMPLE * 2) + 0xfff) & ~0xfff;
|
u32 raw_data_size = (SAMPLESPERBUF * BYTESPERSAMPLE * 2);
|
||||||
u8* raw_data = memalign(0x1000, raw_data_size);
|
u32 raw_data_size_aligned = (raw_data_size + 0xfff) & ~0xfff;
|
||||||
|
u8* raw_data = memalign(0x1000, raw_data_size_aligned);
|
||||||
|
|
||||||
// Ensure buffer was properly allocated
|
// Ensure buffer was properly allocated
|
||||||
if (raw_data == NULL)
|
if (raw_data == NULL)
|
||||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_OutOfMemory));
|
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_OutOfMemory));
|
||||||
|
|
||||||
// Clear the buffer
|
// Clear the buffer
|
||||||
memset(raw_data, 0, raw_data_size);
|
memset(raw_data, 0, raw_data_size_aligned);
|
||||||
|
|
||||||
gfxInitDefault();
|
gfxInitDefault();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user