I've gotten as far as getting the valid checksum for labels with 3 characters or less, and here's a Python function to generate it.
Code: Select all
def group_for_3(label):
group = 0
for i in range(len(label)):
group += 59**(i) * ord(label[-1-i])
return group % 101
I also have a full script I used to generate valid group numbers for song related labels in the Smash Bros. sound.msbt files for 3DS and Wii U. There are some default values that I was able to add generated checksums of "000", potentially up to "ZZZ" for, since this was part of a music expansion project I worked on for the game.
Code: Select all
def base10toN(num, base):
"""Change ``num'' to given base
Upto base 36 is supported."""
converted_string, modstring = "", ""
currentnum = num
if not 1 < base < 37:
raise ValueError("base must be between 2 and 36")
if not num:
return '000'
while currentnum:
mod = currentnum % base
currentnum = currentnum // base
converted_string = chr(48 + mod + 7*(mod > 10)) + converted_string
return converted_string.replace(":", "A").zfill(3)
def group_for_3(label):
group = 0
for i in range(len(label)):
group += 59**(i) * ord(label[-1-i])
return group % 101
# End of label ID numbers for v208 Smash U
currentID = 5212
# Adding 0 to 1001 base 36
for i in range(1001):
labelID = base10toN(i, 36)
# Group for MsndN_SOUND is 1, so we can calculate the 3 char checksum and add, then modulo
print("\t%s:[\"%s\", \"%s\", %s]," % (currentID, "MsndN_SOUND" + labelID, "", (1 + group_for_3(labelID)) % 101))
currentID += 1
# Group for MsndN2_SOUND is 3, so we can calculate the 3 char checksum and add, then modulo
print("\t%s:[\"%s\", \"%s\", %s]," % (currentID, "MsndN2_SOUND" + labelID, "", (3 + group_for_3(labelID)) % 101))
currentID += 1
# Group for MsndO_SOUND is 36, so we can calculate the 3 char checksum and add, then modulo
print("\t%s:[\"%s\", \"%s\", %s]," % (currentID, "MsndO_SOUND" + labelID, "", (36 + group_for_3(labelID)) % 101))
currentID += 1
# Group for MsndW_SOUND is 15, so we can calculate the 3 char checksum and add, then modulo
print("\t%s:[\"%s\", \"%s\", %s]," % (currentID, "MsndW_SOUND" + labelID, "", (15 + group_for_3(labelID)) % 101))
currentID += 1
# Group for MsndS_SOUND is 42, so we can calculate the 3 char checksum and add, then modulo
print("\t%s:[\"%s\", \"%s\", %s]," % (currentID, "MsndS_SOUND" + labelID, "", (42 + group_for_3(labelID)) % 101))
currentID += 1
I've attached msbt files from Smash U for reference, and here's a list of labels, and corresponding group numbers I've generated from a large collection of msbt files to use as a reference. If anyone can help calculate the checksum for a label of ANY size, it would be a huge help to me and anyone else that needs to add entries to msbt files.
http://smashcustommusic.com/~soneek/msbtlabelgroups.txt
I generally suck at explaining things, so let me know if any more info is needed.