JNUSTool/src/de/mas/jnustool/ContentInfo.java

38 lines
982 B
Java
Raw Normal View History

2016-02-02 19:38:53 +01:00
package de.mas.jnustool;
import de.mas.jnustool.util.Util;
/**
* Stores informations of the content [...]
*
*
* Thanks to crediar for the offsets in CDecrypt
* @author Maschell
*
*/
2016-02-01 20:54:01 +01:00
public class ContentInfo {
public short indexOffset; // 0 0x204
2016-02-01 20:54:01 +01:00
public short commandCount; // 2 0x206
public byte[] SHA2 = new byte[32]; // 12 0x208
//TODO: Test, size checking. Untested right now
2016-02-01 20:54:01 +01:00
public ContentInfo(byte[] info){
this.indexOffset=(short)( ((info[0]&0xFF)<<8) | (info[1]&0xFF) );
this.commandCount=(short)( ((info[2]&0xFF)<<8) | (info[3]&0xFF) );
for(int i = 0;i<32;i++){
this.SHA2[i] = info[4+i];
}
}
public ContentInfo(short indexOffset, short commandCount, byte[] SHA2) {
this.indexOffset = indexOffset;
this.commandCount = commandCount;
this.SHA2 = SHA2;
}
2016-02-01 20:54:01 +01:00
@Override
public String toString(){
return "indexOffset: " + indexOffset +" commandCount: " + commandCount + " SHA2: " + Util.ByteArrayToString(SHA2);
}
}