Hi,
Seems like the sacred gold and storm silver hackroms aren't supported by the tool. When they are loaded the program fails.
Motivation
I think they are great hack roms, they fix the problem with the 2nd gen, the level difference between trainers.
In the original game with the tool, you can increase the level base, but that doesn't help to correct the difficulty. For example, the trainers have pokémon at level 8 and the leader is at level 16. It won't help to increase a 20% the level, because you will end with a trainer with level 10 and a leader with level 19, the problem is almost the same.
Problem I advanced so far.
Checking the fail, seems to be a failure with the following method, in the NARCArchive class, failing the System.arraycopy with an ArrayIndexOuOfBoundsException:
` private Map<String, byte[]> readNitroFrames(byte[] data) throws IOException {
// Read the number of frames
int frameCount = readWord(data, 0x0E);
// each frame
int offset = 0x10;
Map<String, byte[]> frames = new TreeMap<>();
for (int i = 0; i < frameCount; i++) {
byte[] magic = new byte[] { data[offset + 3], data[offset + 2], data[offset + 1], data[offset] };
String magicS = new String(magic, "US-ASCII");
int frame_size = readLong(data, offset + 4);
// Patch for BB/VW and other DS hacks which don't update
// the size of their expanded NARCs correctly
if (i == frameCount - 1 && offset + frame_size < data.length) {
frame_size = data.length - offset;
}
byte[] frame = new byte[frame_size - 8];
System.arraycopy(data, offset + 8, frame, 0, frame_size - 8);
frames.put(magicS, frame);
offset += frame_size;
}
return frames;
}`
Checking the comment, it seems to be the same, but the offset + frame_size for the storm silver rom was greater, so I tried to change the '<' to '!=' And the program loaded the rom.
I could save it without randomized too, but when I randomize for example wild & foe encounters the program fails again, when writting in multiple byte[] like
String encountersFile = romEntry.getString("WildPokemon"); NARCArchive encounterData = readNARC(encountersFile);
In some call to writeword over encounterData.files the program is passing an offset larger than the array size, so it crashes (ArrayIndexOuOfBoundsException again!).
I would like to help more but I don't really know what's happening (really complex for me!).
Maybe it's something related to the sizes the files are supposed to have but on the file header they are incorrect and it's written beyond that point? Like the first error, but with the files the rom is supposed to have.
Thanks for reading.