07-17-2010, 09:12 PM
The real file length can be found in the file itself: take the value of offset 4 and add 8 to the value
Does this value differ from the file length generated by the extract tool? I'm wondering how compressed audio data can generate so many file with the same length. They are probably padded at the end.
BTW, Jpcsp was already computing some kind of CRC (AtracCode.java, line 62: Hash.getHashCodeFloatingMemory(0, address, length)) but this is based on the length passed to the sceAtracSetData() call. This length can be shorter than the real file length: the file is sent in small parts/chunks by the application. Also, the length used can differ from application to application and is not fixed. I don't know which length is the minimum length required by the PSP.
So you cannot be sure which length has to be used while computing the CRC outside of Jpcsp...
Code:
// RIFF file format:
// Offset 0: 'RIFF'
// Offset 4: file length - 8
// Offset 8: 'WAVE'
inputFileSize = mem.read32(inputBufferAddr + 4) + 8;
BTW, Jpcsp was already computing some kind of CRC (AtracCode.java, line 62: Hash.getHashCodeFloatingMemory(0, address, length)) but this is based on the length passed to the sceAtracSetData() call. This length can be shorter than the real file length: the file is sent in small parts/chunks by the application. Also, the length used can differ from application to application and is not fixed. I don't know which length is the minimum length required by the PSP.
So you cannot be sure which length has to be used while computing the CRC outside of Jpcsp...