05-08-2010, 07:06 PM
@hyakki and corvenik:
gid coded the hash generator, it's under jpcsp.util.Hash. The getHashCodeFloatingMemory does this:
You'll need to get the memory address and the lenght of the data used in sceAtracSetData and then apply that small algorithm.
Obviously, we can also allow an extra nomenclature to be also accepted aside from this one (e.g.: use the hash version for files to be decoded on a PSP and use another version for files manually decoded).
Just name the files as something like this, for example:
Atrac-[filesize]-[number].decat3
With "number" going from 0 up to the number of atrac files present in the game, just like a playlist. We'll then make JPCSP recognize these files and play them instead.
(05-08-2010, 01:33 PM)corvenik Wrote: @hyakki: about the third part of the atrac filename, i were looking to the atraccodec.java class and this is what i found.
protected String generateID(int address, int length, int fileSize) {
int hashCode = Hash.getHashCodeFloatingMemory(0, address, length);
return String.format("Atrac-%08X-%08X", fileSize, hashCode);
So it seems that the third part is a hashcode, maybe gid15 knows more about this...
gid coded the hash generator, it's under jpcsp.util.Hash. The getHashCodeFloatingMemory does this:
Code:
public static int getHashCodeFloatingMemory(int hashCode, int addr, int lengthInBytes) {
IMemoryReader memoryReader = MemoryReader.getMemoryReader(addr, lengthInBytes, 4);
for (int i = 0; i < lengthInBytes; i += 4) {
int value = memoryReader.readNext();
hashCode ^= value + i;
hashCode += i;
}
return hashCode;
}
You'll need to get the memory address and the lenght of the data used in sceAtracSetData and then apply that small algorithm.
Obviously, we can also allow an extra nomenclature to be also accepted aside from this one (e.g.: use the hash version for files to be decoded on a PSP and use another version for files manually decoded).
Just name the files as something like this, for example:
Atrac-[filesize]-[number].decat3
With "number" going from 0 up to the number of atrac files present in the game, just like a playlist. We'll then make JPCSP recognize these files and play them instead.
![Wink Wink](https://www.emunewz.net/forum/images/smilies/wink.gif)