Nintendo 3DS >> C/C++
VRAM
參考資訊:
1. libctru doc
2. 3ds-examples
說明:
API |
---|
u32 vramSpaceFree(void) |
void* vramAlloc(size_t size) |
size_t vramGetSize(void *mem) |
void vramFree(void *mem) |
main.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include <stdio.h> #include <stdlib.h> #include <string.h> #include <3ds.h> int main ( void ) { gfxInitDefault (); consoleInit ( GFX_TOP , NULL ); uint32_t fsize = vramSpaceFree (); printf ( "vram free size: %d\n" , fsize); if (fsize > 128) { int c = 0; u16 *p = vramAlloc (128); printf ( "vram ptr: %p (size: %d)\n" , p, vramGetSize (p)); for (c=0; c<128; c++) { p[c] = c; } for (c=0; c<128; c++) { if (p[c] != c) { printf ( "mismatch at 0x%x\n" , c); } } vramFree (p); } gspWaitForVBlank (); gfxSwapBuffers (); svcSleepThread (3000000000LL); gfxExit (); return 0; } |
完成