mirror of
https://github.com/switchbrew/switch-examples.git
synced 2025-06-21 13:22:40 +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
|
||||
u32 raw_data_size = ((SAMPLESPERBUF * BYTESPERSAMPLE * 2) + 0xfff) & ~0xfff;
|
||||
u8* raw_data = memalign(0x1000, raw_data_size);
|
||||
u32 raw_data_size = (SAMPLESPERBUF * BYTESPERSAMPLE * 2);
|
||||
u32 raw_data_size_aligned = (raw_data_size + 0xfff) & ~0xfff;
|
||||
u8* raw_data = memalign(0x1000, raw_data_size_aligned);
|
||||
|
||||
// Ensure buffer was properly allocated
|
||||
if (raw_data == NULL)
|
||||
fatalSimple(MAKERESULT(Module_Libnx, LibnxError_OutOfMemory));
|
||||
|
||||
// Clear the buffer
|
||||
memset(raw_data, 0, raw_data_size);
|
||||
memset(raw_data, 0, raw_data_size_aligned);
|
||||
|
||||
gfxInitDefault();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user