Homebrew Help Loading Image From SD Card [SPIDER]

  • Thread starter Thread starter gudenau
  • Start date Start date
  • Views Views 4,457
  • Replies Replies 27
Hmm. Could you check to make sure you are creating splash.bin properly? Not sure what else could be causing garbage graphics.


Code:
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
 
import javax.imageio.ImageIO;
 
 
public class SplashConvert {
    public static void main(String[] args) throws Throwable{
        System.out.println(args[0]);
        System.out.println(args[1]);
       
        BufferedImage image = ImageIO.read(new File(args[0]));
        FileOutputStream out = new FileOutputStream(new File(args[1]));
       
        int[] data = new int[image.getWidth() * image.getHeight()];
        image.getRGB(0, 0, image.getWidth(), image.getHeight(), data, 0, image.getWidth());
 
        byte[] buffer = new byte[data.length * 3];
       
        for(int i = 0; i < data.length; i++){
            buffer[i*3] = (byte) (data[i] & 0x000000FF);
            buffer[i*3+1] = (byte) ((data[i]>>8) & 0x000000FF);
            buffer[i*3+2] = (byte) ((data[i]>>16) & 0x000000FF);
        }
       
        out.write(buffer);
        out.close();
    }
}
 
change IFile_Read(file, read, buf, 0xE100); to IFile_Read(file, read, buf, 0x38400);

this causes a crash, i guess its just too much data to read in. we need to malloc memory so we dont overwrite stuff
 

Site & Scene News

Popular threads in this forum