Merge branch 'refactor' of github.com:smealum/ctrulib into refactor

This commit is contained in:
smea 2014-08-25 09:40:10 -07:00
commit 56d9f4abb3

View File

@ -51,6 +51,8 @@ void gfxSetFramebufferInfo(gfxScreen_t screen, u8 id)
} }
} }
extern u32 __gsp_heap_size;
void gfxInit() void gfxInit()
{ {
gspInit(); gspInit();
@ -65,7 +67,7 @@ void gfxInit()
svcMapMemoryBlock(gspSharedMemHandle, 0x10002000, 0x3, 0x10000000); svcMapMemoryBlock(gspSharedMemHandle, 0x10002000, 0x3, 0x10000000);
//map GSP heap //map GSP heap
svcControlMemory((u32*)&gspHeap, 0x0, 0x0, 0x02000000, 0x10003, 0x3); svcControlMemory((u32*)&gspHeap, 0x0, 0x0, __gsp_heap_size, 0x10003, 0x3);
// default gspHeap configuration : // default gspHeap configuration :
// topleft1 0x00000000-0x00046500 // topleft1 0x00000000-0x00046500
@ -88,19 +90,23 @@ void gfxInit()
gfxSetFramebufferInfo(GFX_TOP, 0); gfxSetFramebufferInfo(GFX_TOP, 0);
gfxSetFramebufferInfo(GFX_BOTTOM, 0); gfxSetFramebufferInfo(GFX_BOTTOM, 0);
//wait until we can write stuff to it
svcWaitSynchronization(gspEvent, 0x55bcb0);
//GSP shared mem : 0x2779F000 //GSP shared mem : 0x2779F000
gxCmdBuf=(u32*)(0x10002000+0x800+threadID*0x200); gxCmdBuf=(u32*)(0x10002000+0x800+threadID*0x200);
currentBuffer=0; currentBuffer=0;
// Initialize event handler and wait for VBlank
gspInitEventHandler(gspEvent, (vu8*)0x10002000, threadID);
gspWaitForVBlank();
} }
void gfxExit() void gfxExit()
{ {
// Exit event handler
gspExitEventHandler();
//free GSP heap //free GSP heap
svcControlMemory((u32*)&gspHeap, (u32)gspHeap, 0x0, 0x02000000, MEMOP_FREE, 0x0); svcControlMemory((u32*)&gspHeap, (u32)gspHeap, 0x0, __gsp_heap_size, MEMOP_FREE, 0x0);
//unmap GSP shared mem //unmap GSP shared mem
svcUnmapMemoryBlock(gspSharedMemHandle, 0x10002000); svcUnmapMemoryBlock(gspSharedMemHandle, 0x10002000);