diff --git a/libctru/source/gfx.c b/libctru/source/gfx.c index 8c8b79b..d32dcc6 100644 --- a/libctru/source/gfx.c +++ b/libctru/source/gfx.c @@ -17,8 +17,6 @@ bool enable3d; Handle gspEvent, gspSharedMemHandle; -u32* gxCmdBuf; - void gfxSet3D(bool enable) { enable3d=enable; diff --git a/libctru/source/services/gx.c b/libctru/source/services/gx.c index c4fd8a1..3e79fa0 100644 --- a/libctru/source/services/gx.c +++ b/libctru/source/services/gx.c @@ -5,8 +5,12 @@ #include #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