Page 1 of 1

Load Image for sdcard / socket

Posted: Mon Nov 26, 2018 9:29 am
by TurtleForGaming
So I'm trying to develop a streaming app for the nintendo dsi so that I can use is to controll a robot. I just wanted to know if it's possible to load at .bmp / .png at the root of the sdcard and display it on the bottom screen and still be able to modify the top screen. I don't talk about very high fps like 10-15 is good enought but the final project is to bee able to have a python script somewhere that would convert an video flux an transimit it to the nds sdcreen. After some research I stamble on this code:

Code: Select all

void displayPicture(){
    
	fatInitDefault();
    FILE *pFile=fopen("/t.bmp","rb");
     
    if (pFile!=NULL)   {
	//file size
      fseek (pFile, 0 , SEEK_END);
      long lSize = ftell (pFile);
      u8 *buffer= (u8*) malloc (sizeof(u8)*lSize);
      rewind (pFile);
     
      if (fread (buffer,1,lSize,pFile) != lSize)
         printf("\n File could not be read\n"); //
     
      //copy from buffer
        dmaCopy(buffer, BG_GFX_SUB, lSize);
		printf("%u",buffer);
        decompress(buffer, BG_GFX_SUB, LZ77Vram);

      //close file and clean buffer
      fclose (pFile);
      free (buffer);
    }
    else printf("\n FileNotFound!\n");
}
But it don't really work like nothing appears. So I'm asking for a bit of help here.

Re: Load Image for sdcard / socket

Posted: Tue Jan 22, 2019 10:08 am
by WinterMute
You won't be able to modify files on the SD card externally while a DS app is running, you'll need to transfer data via wifi for something like this.

The code you have here should display something, assuming you have the video set up. If it's based on the 16bit bitmap example you'll need to make sure bit 15 of each pixel is set otherwise the graphics hardware treats it as transparent.