Homebrew Help Loading Image From SD Card [SPIDER]

gudenau

Largely ignored
OP
Member
Joined
Jul 7, 2010
Messages
3,882
Trophies
2
Location
/dev/random
Website
www.gudenau.net
XP
5,381
Country
United States
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();
    }
}
 

KazoWAR

Well-Known Member
Member
Joined
Aug 12, 2008
Messages
1,952
Trophies
1
Age
35
Location
Winter Haven
XP
2,125
Country
United States
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

General chit-chat
Help Users
  • No one is chatting at the moment.
    Psionic Roshambo @ Psionic Roshambo: I did use a bot for Diablo III though but no ban there lol