Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <malloc.h>
- #include <ogcsys.h>
- static void *xfb = NULL;
- static GXRModeObj *rmode = NULL;
- void initialise_video()
- {
- VIDEO_Init();
- rmode = VIDEO_GetPreferredMode(NULL);
- xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
- console_init(xfb,20, 20, rmode->fbWidth, rmode->xfbHeight, rmode->fbWidth * VI_DISPLAY_PIX_SZ);
- VIDEO_Configure(rmode);
- VIDEO_SetNextFramebuffer(xfb);
- VIDEO_SetBlack(FALSE);
- VIDEO_Flush();
- printf("\x1b[2;0H");
- VIDEO_WaitVSync();
- if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
- }
- #define isMEM2Buffer(p) (((u32) p & 0x10000000) != 0)
- int main(int argc, char **argv)
- {
- initialise_video();
- while(1)
- {
- char *ptr = malloc(40);
- if(ptr> 0x817fcf00)
- {
- printf("%p\n", ptr);
- if(isMEM2Buffer(ptr))
- {
- printf("mem2 reached\n");
- ptr = malloc(40);
- printf("%p\n", ptr);
- ptr = malloc(40);
- printf("%p\n", ptr);
- ptr = malloc(40);
- printf("%p\n", ptr);
- break;
- }
- }
- }
- printf("exiting...\n");
- sleep(2);
- return 0;
- }
Add Comment
Please, Sign In to add comment