looking for help on how to repack sprites im using Janus from the downloads part

 
Feb 28, 2024
10
0
0
i wanted to change the sprites around for loginscreen so i used the dump method in the spriteloader.java now i want to repack the sprites(cant find a spritepacker that work) instead it has this method in the client.java to repack but im unsure what to name the folder in the cache any help would be apperciated​
public void repackCacheIndex(int cacheIndex) {
System.out.println("Started repacking index " + cacheIndex + ".");
int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
try {
for (int index = 0; index < indexLength; index++) {
int fileIndex = Integer.parseInt(getFileNameWithoutExtension(file[index].toString()));
byte[] data = fileToByteArray(cacheIndex, fileIndex);
if (data != null && data.length > 0) {
cacheIndices[cacheIndex].put(data.length, data, fileIndex);
System.out.println("Repacked " + fileIndex + ".");
} else {
System.out.println("Unable to locate index " + fileIndex + ".");
}
}
} catch (Exception e) {
System.out.println("Error packing cache index " + cacheIndex + ".");
}
System.out.println("Finished repacking " + cacheIndex + ".");
}

public byte[] fileToByteArray(int cacheIndex, int index) {
try {
if (indexLocation(cacheIndex, index).length() <= 0 || indexLocation(cacheIndex, index) == null) {
return null;
}
File file = new File(indexLocation(cacheIndex, index));
byte[] fileData = new byte[(int) file.length()];
FileInputStream fis = new FileInputStream(file);
fis.read(fileData);
fis.close();
return fileData;
} catch (Exception e) {
return null;
}
}​
 

Users who are viewing this thread (total: 1, members: 0, guests: 1)

Who read this thread (total members: 11)