Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
286e79774c
26
examples/Makefile
Normal file
26
examples/Makefile
Normal file
@ -0,0 +1,26 @@
|
||||
SUBDIRS:= $(shell ls | egrep -v '^(CVS)$$')
|
||||
|
||||
DATESTRING := $(shell date +%Y)$(shell date +%m)$(shell date +%d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
all: examples
|
||||
#---------------------------------------------------------------------------------
|
||||
@rm -fr bin
|
||||
@mkdir -p bin
|
||||
@find . -name "*.3dsx" -exec cp -fv {} bin \;
|
||||
|
||||
examples:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
#---------------------------------------------------------------------------------
|
||||
@rm -fr bin
|
||||
@rm -f *.bz2
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
dist: clean
|
||||
#---------------------------------------------------------------------------------
|
||||
@rm -fr bin
|
||||
@tar --exclude=.svn --exclude=*CVS* -cvjf 3ds-examples-$(DATESTRING).tar.bz2 *
|
@ -6,10 +6,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
srvInit(); // Needed
|
||||
aptInit(); // Needed
|
||||
gfxInit(); // Init graphic stuff
|
||||
hidInit(NULL); // For input (buttons, touchscreen...)
|
||||
gfxInitDefault(); // Init graphic stuff
|
||||
|
||||
|
||||
// We need these 2 buffers for APT_DoAppJump() later. They can be smaller too
|
||||
@ -46,11 +43,7 @@ int main()
|
||||
}
|
||||
|
||||
|
||||
// Deinit everything before the app process get's terminated
|
||||
hidExit();
|
||||
gfxExit();
|
||||
aptExit();
|
||||
srvExit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -13,10 +13,7 @@ int main()
|
||||
u8 control=0x40;
|
||||
u32 audio_initialized = 0;
|
||||
|
||||
srvInit();
|
||||
aptInit();
|
||||
gfxInit();
|
||||
hidInit(NULL);
|
||||
gfxInitDefault();
|
||||
|
||||
if(CSND_initialize(NULL)==0)audio_initialized = 1;
|
||||
|
||||
@ -85,10 +82,7 @@ int main()
|
||||
free(sharedmem);
|
||||
linearFree(audiobuf);
|
||||
|
||||
hidExit();
|
||||
gfxExit();
|
||||
aptExit();
|
||||
srvExit();
|
||||
return 0;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Initialize services
|
||||
gfxInit();
|
||||
gfxInitDefault();
|
||||
initCfgu();
|
||||
|
||||
|
||||
|
@ -189,11 +189,8 @@ void renderFrame()
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
//setup services
|
||||
srvInit();
|
||||
aptInit();
|
||||
gfxInit();
|
||||
hidInit(NULL);
|
||||
|
||||
gfxInitDefault();
|
||||
|
||||
//initialize GPU
|
||||
GPU_Init(NULL);
|
||||
@ -321,9 +318,6 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
gsExit();
|
||||
hidExit();
|
||||
gfxExit();
|
||||
aptExit();
|
||||
srvExit();
|
||||
return 0;
|
||||
}
|
||||
|
7
examples/graphics/Makefile
Normal file
7
examples/graphics/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
install:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i install || { exit 1;} fi; done;
|
7
examples/graphics/printing/Makefile
Normal file
7
examples/graphics/printing/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
install:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i install || { exit 1;} fi; done;
|
@ -17,11 +17,7 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Initialize services
|
||||
srvInit();
|
||||
aptInit();
|
||||
gfxInit();
|
||||
hidInit(NULL);
|
||||
gfxInitDefault();
|
||||
|
||||
//Initialize console on top screen. Using NULL as the second argument tells the console library to use the internal console structure as current one
|
||||
consoleInit(GFX_TOP, NULL);
|
||||
@ -54,10 +50,6 @@ int main(int argc, char **argv)
|
||||
gspWaitForVBlank();
|
||||
}
|
||||
|
||||
// Exit services
|
||||
gfxExit();
|
||||
hidExit();
|
||||
aptExit();
|
||||
srvExit();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,27 +1,18 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <3ds.h>
|
||||
|
||||
Result http_download(httpcContext *context)//This error handling needs updated with proper text printing once ctrulib itself supports that.
|
||||
{
|
||||
Result ret=0;
|
||||
u8* framebuf_top, *framebuf_bottom;
|
||||
u8* framebuf_top;
|
||||
u32 statuscode=0;
|
||||
u32 size=0, contentsize=0;
|
||||
u8 *buf;
|
||||
|
||||
framebuf_bottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
|
||||
memset(framebuf_bottom, 0x40, 240*320*3);
|
||||
gfxFlushBuffers();
|
||||
gfxSwapBuffers();
|
||||
|
||||
framebuf_bottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
|
||||
memset(framebuf_bottom, 0x40, 240*320*3);
|
||||
gfxFlushBuffers();
|
||||
gfxSwapBuffers();
|
||||
gspWaitForVBlank();
|
||||
|
||||
ret = httpcBeginRequest(context);
|
||||
if(ret!=0)return ret;
|
||||
|
||||
@ -33,23 +24,13 @@ Result http_download(httpcContext *context)//This error handling needs updated w
|
||||
ret=httpcGetDownloadSizeState(context, NULL, &contentsize);
|
||||
if(ret!=0)return ret;
|
||||
|
||||
printf("size: %"PRId32"\n",contentsize);
|
||||
gfxFlushBuffers();
|
||||
|
||||
buf = (u8*)malloc(contentsize);
|
||||
if(buf==NULL)return -1;
|
||||
memset(buf, 0, contentsize);
|
||||
|
||||
framebuf_bottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
|
||||
memset(framebuf_bottom, 0xc0, 240*320*3);
|
||||
gfxFlushBuffers();
|
||||
gfxSwapBuffers();
|
||||
|
||||
framebuf_bottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
|
||||
memset(framebuf_bottom, 0xc0, 240*320*3);
|
||||
gfxFlushBuffers();
|
||||
gfxSwapBuffers();
|
||||
gspWaitForVBlank();
|
||||
|
||||
framebuf_top = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
|
||||
framebuf_bottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
|
||||
|
||||
ret = httpcDownloadData(context, buf, contentsize, NULL);
|
||||
if(ret!=0)
|
||||
@ -59,18 +40,15 @@ Result http_download(httpcContext *context)//This error handling needs updated w
|
||||
}
|
||||
|
||||
size = contentsize;
|
||||
if(size>(240*400*3))size = 240*400*3;
|
||||
if(size>(240*400*3*2))size = 240*400*3*2;
|
||||
|
||||
memset(framebuf_bottom, 0xff, 240*320*3);
|
||||
framebuf_top = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
|
||||
memcpy(framebuf_top, buf, size);
|
||||
|
||||
gfxFlushBuffers();
|
||||
gfxSwapBuffers();
|
||||
|
||||
framebuf_top = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
|
||||
framebuf_bottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
|
||||
|
||||
memset(framebuf_bottom, 0xff, 240*320*3);
|
||||
memcpy(framebuf_top, buf, size);
|
||||
|
||||
gfxFlushBuffers();
|
||||
@ -87,19 +65,26 @@ int main()
|
||||
Result ret=0;
|
||||
httpcContext context;
|
||||
|
||||
// Initialize services
|
||||
srvInit();
|
||||
aptInit();
|
||||
hidInit(NULL);
|
||||
gfxInit();
|
||||
//gfxSet3D(true); // uncomment if using stereoscopic 3D
|
||||
gfxInitDefault();
|
||||
httpcInit();
|
||||
|
||||
ret = httpcOpenContext(&context, "http://10.0.0.3/httpexample_rawimg.bin", 0);//Change this to your own URL.
|
||||
consoleInit(GFX_BOTTOM,NULL);
|
||||
|
||||
//Change this to your own URL.
|
||||
char *url = "http://devkitpro.org/misc/httpexample_rawimg.rgb";
|
||||
|
||||
printf("Downloading %s\n",url);
|
||||
gfxFlushBuffers();
|
||||
|
||||
ret = httpcOpenContext(&context, url , 0);
|
||||
printf("return from httpcOpenContext: %"PRId32"\n",ret);
|
||||
gfxFlushBuffers();
|
||||
|
||||
if(ret==0)
|
||||
{
|
||||
ret=http_download(&context);
|
||||
printf("return from http_download: %"PRId32"\n",ret);
|
||||
gfxFlushBuffers();
|
||||
httpcCloseContext(&context);
|
||||
}
|
||||
|
||||
@ -123,9 +108,6 @@ int main()
|
||||
// Exit services
|
||||
httpcExit();
|
||||
gfxExit();
|
||||
hidExit();
|
||||
aptExit();
|
||||
srvExit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,7 @@ int main()
|
||||
{
|
||||
u32 val, i;
|
||||
|
||||
// Initialize services
|
||||
srvInit();
|
||||
aptInit();
|
||||
hidInit(NULL);
|
||||
gfxInit();
|
||||
gfxInitDefault();
|
||||
//gfxSet3D(true); // uncomment if using stereoscopic 3D
|
||||
|
||||
val = 0x22447899;
|
||||
@ -42,9 +38,6 @@ int main()
|
||||
|
||||
// Exit services
|
||||
gfxExit();
|
||||
hidExit();
|
||||
aptExit();
|
||||
srvExit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -106,13 +106,7 @@ void draw_startup()
|
||||
|
||||
int main()
|
||||
{
|
||||
// Initialize services
|
||||
srvInit();
|
||||
aptInit();
|
||||
hidInit(NULL);
|
||||
gfxInit();
|
||||
fsInit();
|
||||
sdmcInit();
|
||||
gfxInitDefault();
|
||||
//gfxSet3D(true); // uncomment if using stereoscopic 3D
|
||||
|
||||
memset(logstring, 0, 256);
|
||||
@ -143,13 +137,7 @@ int main()
|
||||
if(inaddr)linearFree(inaddr);
|
||||
if(outaddr)linearFree(outaddr);
|
||||
|
||||
// Exit services
|
||||
sdmcExit();
|
||||
fsExit();
|
||||
gfxExit();
|
||||
hidExit();
|
||||
aptExit();
|
||||
srvExit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,7 @@ int main()
|
||||
qtmHeadtrackingInfo qtminfo;
|
||||
u32 colors[4] = {0x0000FF, 0x00FF00, 0xFF0000, 0xFFFFFF};
|
||||
|
||||
// Initialize services
|
||||
srvInit();
|
||||
aptInit();
|
||||
hidInit(NULL);
|
||||
gfxInit();
|
||||
gfxInitDefault();
|
||||
//gfxSet3D(true); // uncomment if using stereoscopic 3D
|
||||
|
||||
qtmInit();
|
||||
@ -84,9 +80,6 @@ int main()
|
||||
// Exit services
|
||||
qtmExit();
|
||||
gfxExit();
|
||||
hidExit();
|
||||
aptExit();
|
||||
srvExit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ void renderEffect()
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
gfxInit(); //makes displaying to screen easier
|
||||
gfxInitDefault(); //makes displaying to screen easier
|
||||
|
||||
FILE *file = fopen("test.bin","rb");
|
||||
if (file == NULL) goto exit;
|
||||
|
7
examples/templates/Makefile
Normal file
7
examples/templates/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
install:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i install || { exit 1;} fi; done;
|
@ -4,11 +4,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
// Initialize services
|
||||
srvInit();
|
||||
aptInit();
|
||||
hidInit(NULL);
|
||||
gfxInit();
|
||||
gfxInitDefault();
|
||||
//gfxSet3D(true); // uncomment if using stereoscopic 3D
|
||||
|
||||
// Main loop
|
||||
@ -36,10 +32,6 @@ int main()
|
||||
gfxSwapBuffers();
|
||||
}
|
||||
|
||||
// Exit services
|
||||
gfxExit();
|
||||
hidExit();
|
||||
aptExit();
|
||||
srvExit();
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ endif
|
||||
include $(DEVKITARM)/base_rules
|
||||
|
||||
export LIBCTRU_MAJOR := 0
|
||||
export LIBCTRU_MINOR := 2
|
||||
export LIBCTRU_MINOR := 3
|
||||
export LIBCTRU_PATCH := 0
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -23,7 +23,7 @@ consoleInit()
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef bool(* ConsolePrint)(void* con, char c);
|
||||
typedef bool(* ConsolePrint)(void* con, int c);
|
||||
|
||||
//! a font struct for the console.
|
||||
typedef struct ConsoleFont
|
||||
|
@ -19,7 +19,8 @@ typedef enum
|
||||
}gfx3dSide_t;
|
||||
|
||||
//system stuff
|
||||
void gfxInit();
|
||||
void gfxInitDefault();
|
||||
void gfxInit(GSP_FramebufferFormats topFormat, GSP_FramebufferFormats bottomFormat, bool vrambuffers);
|
||||
void gfxExit();
|
||||
|
||||
//control stuff
|
||||
|
@ -1,30 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <3ds/types.h>
|
||||
|
||||
#define CSND_SHAREDMEM_DEFAULT 0x10004000
|
||||
|
||||
typedef enum{
|
||||
CSND_LOOP_DISABLE,
|
||||
CSND_LOOP_ENABLE
|
||||
CSND_LOOP_DISABLE,
|
||||
CSND_LOOP_ENABLE
|
||||
} CSND_LOOPING;
|
||||
|
||||
typedef enum{
|
||||
CSND_ENCODING_PCM8,
|
||||
CSND_ENCODING_PCM16,
|
||||
CSND_ENCODING_IMA_ADPCM,
|
||||
CSND_ENCODING_PSG//"3 = PSG, similar to DS?"
|
||||
CSND_ENCODING_PCM8,
|
||||
CSND_ENCODING_PCM16,
|
||||
CSND_ENCODING_IMA_ADPCM,
|
||||
CSND_ENCODING_PSG//"3 = PSG, similar to DS?"
|
||||
} CSND_ENCODING;
|
||||
|
||||
struct CSND_CHANNEL_STATUS {
|
||||
u8 state;
|
||||
u8 pad[3];
|
||||
u32 unknown;
|
||||
u32 position;
|
||||
} ALIGN(4);
|
||||
|
||||
|
||||
//See here regarding CSND shared-mem commands, etc: http://3dbrew.org/wiki/CSND_Shared_Memory
|
||||
|
||||
Result CSND_initialize(u32* sharedMem);
|
||||
Result CSND_shutdown();
|
||||
|
||||
u32 CSND_convertsamplerate(u32 samplerate);
|
||||
Result CSND_playsound(u32 channel, u32 looping, u32 encoding, u32 samplerate, u32 *vaddr0, u32 *vaddr1, u32 totalbytesize, u32 unk0, u32 unk1);
|
||||
void CSND_setchannel_playbackstate(u32 channel, u32 value);
|
||||
void CSND_sharedmemtype0_cmd0(u32 channel, u32 value);
|
||||
void CSND_writesharedmem_cmdtype0(u16 cmdid, u8 *cmdparams);
|
||||
Result CSND_sharedmemtype0_cmdupdatestate(int waitdone);
|
||||
|
||||
Result CSND_getchannelstate(u32 entryindex, u32 *out);
|
||||
Result CSND_getchannelstate(u32 entryindex, struct CSND_CHANNEL_STATUS *out);
|
||||
Result CSND_getchannelstate_isplaying(u32 entryindex, u8 *status);
|
||||
|
@ -42,3 +42,9 @@ typedef s32 Result;
|
||||
typedef void (*ThreadFunc)(u32);
|
||||
|
||||
#define BIT(n) (1U<<(n))
|
||||
|
||||
//! aligns a struct (and other types?) to m, making sure that the size of the struct is a multiple of m.
|
||||
#define ALIGN(m) __attribute__((aligned (m)))
|
||||
|
||||
//! packs a struct (and other types?) so it won't include padding bytes.
|
||||
#define PACKED __attribute__ ((packed))
|
||||
|
@ -39,6 +39,7 @@ bool MemPool::Allocate(MemChunk& chunk, u32 size, int align)
|
||||
{
|
||||
auto addr = b->base;
|
||||
u32 begWaste = (u32)addr & alignM;
|
||||
if (begWaste > 0) begWaste = alignM + 1 - begWaste;
|
||||
addr += begWaste;
|
||||
u32 bSize = b->size - begWaste;
|
||||
if (bSize < size) continue;
|
||||
|
@ -43,7 +43,7 @@ PrintConsole defaultConsole =
|
||||
{
|
||||
(u8*)default_font_bin, //font gfx
|
||||
0, //first ascii character in the set
|
||||
128 //number of characters in the font set
|
||||
256 //number of characters in the font set
|
||||
},
|
||||
(u16*)NULL,
|
||||
0,0, //cursorX cursorY
|
||||
@ -68,7 +68,7 @@ PrintConsole* currentConsole = ¤tCopy;
|
||||
|
||||
PrintConsole* consoleGetDefault(void){return &defaultConsole;}
|
||||
|
||||
void consolePrintChar(char c);
|
||||
void consolePrintChar(int c);
|
||||
void consoleDrawChar(int c);
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
@ -672,7 +672,7 @@ void consoleDrawChar(int c) {
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void consolePrintChar(char c) {
|
||||
void consolePrintChar(int c) {
|
||||
//---------------------------------------------------------------------------------
|
||||
if (c==0) return;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <3ds/gfx.h>
|
||||
#include <3ds/svc.h>
|
||||
#include <3ds/linear.h>
|
||||
#include <3ds/vram.h>
|
||||
|
||||
GSP_FramebufferInfo topFramebufferInfo, bottomFramebufferInfo;
|
||||
|
||||
@ -96,8 +97,23 @@ void gfxWriteFramebufferInfo(gfxScreen_t screen)
|
||||
framebufferInfoHeader[0x1]=1;
|
||||
}
|
||||
|
||||
void gfxInit()
|
||||
void (*screenFree)(void *) = NULL;
|
||||
|
||||
void gfxInit(GSP_FramebufferFormats topFormat, GSP_FramebufferFormats bottomFormat, bool vrambuffers)
|
||||
{
|
||||
void *(*screenAlloc)(size_t);
|
||||
|
||||
if (vrambuffers)
|
||||
{
|
||||
screenAlloc=vramAlloc;
|
||||
screenFree=vramFree;
|
||||
|
||||
} else {
|
||||
|
||||
screenAlloc=linearAlloc;
|
||||
screenFree=linearFree;
|
||||
}
|
||||
|
||||
gspInit();
|
||||
|
||||
gfxSharedMemory=(u8*)0x10002000;
|
||||
@ -117,15 +133,22 @@ void gfxInit()
|
||||
// if 3d enabled :
|
||||
// topright1 0x000FD200-0x00143700
|
||||
// topright2 0x00143700-0x00189C00
|
||||
u32 topSize = 400 * 240 * __get_bytes_per_pixel(topFormat);
|
||||
u32 bottomSize = 320 * 240 * __get_bytes_per_pixel(bottomFormat);
|
||||
|
||||
gfxTopLeftFramebuffers[0]=screenAlloc(topSize);
|
||||
gfxTopLeftFramebuffers[1]=screenAlloc(topSize);
|
||||
gfxBottomFramebuffers[0]=screenAlloc(bottomSize);
|
||||
gfxBottomFramebuffers[1]=screenAlloc(bottomSize);
|
||||
gfxTopRightFramebuffers[0]=screenAlloc(topSize);
|
||||
gfxTopRightFramebuffers[1]=screenAlloc(topSize);
|
||||
|
||||
gfxTopLeftFramebuffers[0]=linearAlloc(0x46500);
|
||||
gfxTopLeftFramebuffers[1]=linearAlloc(0x46500);
|
||||
gfxBottomFramebuffers[0]=linearAlloc(0x38400);
|
||||
gfxBottomFramebuffers[1]=linearAlloc(0x38400);
|
||||
gfxTopRightFramebuffers[0]=linearAlloc(0x46500);
|
||||
gfxTopRightFramebuffers[1]=linearAlloc(0x46500);
|
||||
enable3d=false;
|
||||
|
||||
//set requested modes
|
||||
gfxSetScreenFormat(GFX_TOP,topFormat);
|
||||
gfxSetScreenFormat(GFX_BOTTOM,bottomFormat);
|
||||
|
||||
//initialize framebuffer info structures
|
||||
gfxSetFramebufferInfo(GFX_TOP, 0);
|
||||
gfxSetFramebufferInfo(GFX_BOTTOM, 0);
|
||||
@ -143,18 +166,24 @@ void gfxInit()
|
||||
GSPGPU_SetLcdForceBlack(NULL, 0x0);
|
||||
}
|
||||
|
||||
void gfxInitDefault() {
|
||||
gfxInit(GSP_BGR8_OES,GSP_BGR8_OES,false);
|
||||
}
|
||||
|
||||
void gfxExit()
|
||||
{
|
||||
if (screenFree == NULL ) return;
|
||||
|
||||
// Exit event handler
|
||||
gspExitEventHandler();
|
||||
|
||||
// Free framebuffers
|
||||
linearFree(gfxTopRightFramebuffers[1]);
|
||||
linearFree(gfxTopRightFramebuffers[0]);
|
||||
linearFree(gfxBottomFramebuffers[1]);
|
||||
linearFree(gfxBottomFramebuffers[0]);
|
||||
linearFree(gfxTopLeftFramebuffers[1]);
|
||||
linearFree(gfxTopLeftFramebuffers[0]);
|
||||
screenFree(gfxTopRightFramebuffers[1]);
|
||||
screenFree(gfxTopRightFramebuffers[0]);
|
||||
screenFree(gfxBottomFramebuffers[1]);
|
||||
screenFree(gfxBottomFramebuffers[0]);
|
||||
screenFree(gfxTopLeftFramebuffers[1]);
|
||||
screenFree(gfxTopLeftFramebuffers[0]);
|
||||
|
||||
//unmap GSP shared mem
|
||||
svcUnmapMemoryBlock(gspSharedMemHandle, 0x10002000);
|
||||
@ -167,6 +196,8 @@ void gfxExit()
|
||||
GSPGPU_ReleaseRight(NULL);
|
||||
|
||||
gspExit();
|
||||
|
||||
screenFree = NULL;
|
||||
}
|
||||
|
||||
u8* gfxGetFramebuffer(gfxScreen_t screen, gfx3dSide_t side, u16* width, u16* height)
|
||||
@ -185,9 +216,12 @@ u8* gfxGetFramebuffer(gfxScreen_t screen, gfx3dSide_t side, u16* width, u16* hei
|
||||
|
||||
void gfxFlushBuffers()
|
||||
{
|
||||
GSPGPU_FlushDataCache(NULL, gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), 0x46500);
|
||||
if(enable3d)GSPGPU_FlushDataCache(NULL, gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL), 0x46500);
|
||||
GSPGPU_FlushDataCache(NULL, gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL), 0x38400);
|
||||
u32 topSize = 400 * 240 * __get_bytes_per_pixel(gfxGetScreenFormat(GFX_TOP));
|
||||
u32 bottomSize = 320 * 240 * __get_bytes_per_pixel(gfxGetScreenFormat(GFX_BOTTOM));
|
||||
|
||||
GSPGPU_FlushDataCache(NULL, gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL), topSize);
|
||||
if(enable3d)GSPGPU_FlushDataCache(NULL, gfxGetFramebuffer(GFX_TOP, GFX_RIGHT, NULL, NULL), topSize);
|
||||
GSPGPU_FlushDataCache(NULL, gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL), bottomSize);
|
||||
}
|
||||
|
||||
void gfxSwapBuffers()
|
||||
|
@ -301,14 +301,14 @@ Result CSND_playsound(u32 channel, u32 looping, u32 encoding, u32 samplerate, u3
|
||||
return CSND_sharedmemtype0_cmdupdatestate(0);
|
||||
}
|
||||
|
||||
Result CSND_getchannelstate(u32 entryindex, u32 *out)
|
||||
Result CSND_getchannelstate(u32 entryindex, struct CSND_CHANNEL_STATUS *out)
|
||||
{
|
||||
Result ret=0;
|
||||
|
||||
if((ret = CSND_sharedmemtype0_cmdupdatestate(1))!=0)return ret;
|
||||
|
||||
memcpy(out, &CSND_sharedmem[(CSND_sharedmem_cmdblocksize+8 + entryindex*0xc) >> 2], 0xc);
|
||||
out[2] -= 0x0c000000;
|
||||
out->position -= 0x0c000000;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -316,12 +316,12 @@ Result CSND_getchannelstate(u32 entryindex, u32 *out)
|
||||
Result CSND_getchannelstate_isplaying(u32 entryindex, u8 *status)
|
||||
{
|
||||
Result ret;
|
||||
u32 entry[0xc>>2];
|
||||
struct CSND_CHANNEL_STATUS entry;
|
||||
|
||||
ret = CSND_getchannelstate(entryindex, entry);
|
||||
ret = CSND_getchannelstate(entryindex, &entry);
|
||||
if(ret!=0)return ret;
|
||||
|
||||
*status = entry[0] & 0xff;
|
||||
*status = entry.state;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -15,9 +15,6 @@ void __attribute__((weak)) __attribute__((noreturn)) __libctru_exit(int rc)
|
||||
{
|
||||
u32 tmp=0;
|
||||
|
||||
// Run the global destructors
|
||||
__libc_fini_array();
|
||||
|
||||
__appExit();
|
||||
|
||||
// Unmap the linear heap
|
||||
|
@ -12,9 +12,6 @@ void __system_allocateHeaps();
|
||||
void __system_initArgv();
|
||||
void __appInit();
|
||||
|
||||
// newlib definitions we need
|
||||
void __libc_init_array(void);
|
||||
|
||||
|
||||
void __ctru_exit(int rc);
|
||||
|
||||
@ -32,6 +29,4 @@ void __attribute__((weak)) __libctru_init(void (*retAddr)(void))
|
||||
|
||||
__appInit();
|
||||
|
||||
// Run the global constructors
|
||||
__libc_init_array();
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ initSystem:
|
||||
bics sp, sp, #7
|
||||
str sp, [r2]
|
||||
|
||||
bl __libc_init_array
|
||||
|
||||
ldr r2, =saved_stack
|
||||
ldr lr, [r2,#4]
|
||||
bx lr
|
||||
@ -31,6 +33,8 @@ initSystem:
|
||||
.type __ctru_exit, %function
|
||||
|
||||
__ctru_exit:
|
||||
bl __libc_fini_array
|
||||
|
||||
ldr r2, =saved_stack
|
||||
ldr sp, [r2]
|
||||
b __libctru_exit
|
||||
|
Loading…
Reference in New Issue
Block a user