]> Chaos Git - corbenik/ctrulib.git/commitdiff
Make GX_* functions accept NULL in order to use default GX cmdbuf
authorfincs <fincs.alt1@gmail.com>
Sat, 8 Nov 2014 22:28:51 +0000 (23:28 +0100)
committerfincs <fincs.alt1@gmail.com>
Sat, 8 Nov 2014 22:28:51 +0000 (23:28 +0100)
libctru/source/gfx.c
libctru/source/services/gx.c

index 8c8b79b5a07e84a91f95d25016d591c4502cda5e..d32dcc6b03c87a0a17ea522511ae8cc684141e35 100644 (file)
@@ -17,8 +17,6 @@ bool enable3d;
 
 Handle gspEvent, gspSharedMemHandle;
 
-u32* gxCmdBuf;
-
 void gfxSet3D(bool enable)
 {
        enable3d=enable;
index c4fd8a173ec8df89c6b87d156eb454db116c9ef5..3e79fa00e3c36bef84a5384ef8cd6b1dd91b69cb 100644 (file)
@@ -5,8 +5,12 @@
 #include <stdlib.h>
 #include <3ds.h>
 
+u32* gxCmdBuf;
+
 Result GX_RequestDma(u32* gxbuf, u32* src, u32* dst, u32 length)
 {
+       if(!gxbuf)gxbuf=gxCmdBuf;
+
        u32 gxCommand[0x8];
        gxCommand[0]=0x00; //CommandID
        gxCommand[1]=(u32)src; //source address
@@ -19,6 +23,8 @@ Result GX_RequestDma(u32* gxbuf, u32* src, u32* dst, u32 length)
 
 Result GX_SetCommandList_Last(u32* gxbuf, u32* buf0a, u32 buf0s, u8 flags)
 {
+       if(!gxbuf)gxbuf=gxCmdBuf;
+
        u32 gxCommand[0x8];
        gxCommand[0]=0x01; //CommandID
        gxCommand[1]=(u32)buf0a; //buf0 address
@@ -32,6 +38,8 @@ Result GX_SetCommandList_Last(u32* gxbuf, u32* buf0a, u32 buf0s, u8 flags)
 
 Result GX_SetMemoryFill(u32* gxbuf, u32* buf0a, u32 buf0v, u32* buf0e, u16 width0, u32* buf1a, u32 buf1v, u32* buf1e, u16 width1)
 {
+       if(!gxbuf)gxbuf=gxCmdBuf;
+
        u32 gxCommand[0x8];
        // gxCommand[0]=0x02; //CommandID
        gxCommand[0]=0x01000102; //CommandID
@@ -49,6 +57,8 @@ Result GX_SetMemoryFill(u32* gxbuf, u32* buf0a, u32 buf0v, u32* buf0e, u16 width
 // Flags, for applications this is 0x1001000 for the main screen, and 0x1000 for the sub screen.
 Result GX_SetDisplayTransfer(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 flags)
 {
+       if(!gxbuf)gxbuf=gxCmdBuf;
+
        u32 gxCommand[0x8];
        gxCommand[0]=0x03; //CommandID
        gxCommand[1]=(u32)inadr;
@@ -63,6 +73,8 @@ Result GX_SetDisplayTransfer(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32
 
 Result GX_SetTextureCopy(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 outdim, u32 size, u32 flags)
 {
+       if(!gxbuf)gxbuf=gxCmdBuf;
+
        u32 gxCommand[0x8];
        gxCommand[0]=0x04; //CommandID
        gxCommand[1]=(u32)inadr;
@@ -78,6 +90,8 @@ Result GX_SetTextureCopy(u32* gxbuf, u32* inadr, u32 indim, u32* outadr, u32 out
 
 Result GX_SetCommandList_First(u32* gxbuf, u32* buf0a, u32 buf0s, u32* buf1a, u32 buf1s, u32* buf2a, u32 buf2s)
 {
+       if(!gxbuf)gxbuf=gxCmdBuf;
+
        u32 gxCommand[0x8];
        gxCommand[0]=0x05; //CommandID
        gxCommand[1]=(u32)buf0a; //buf0 address