ROM Hack [Release] MSBT Editor Reloaded

IcySon55

Leader of Fan Translators International
OP
Member
Joined
Mar 18, 2008
Messages
463
Trophies
1
Age
38
XP
2,261
Country
Canada
@Zarklord I don't. There's no need for me to know how the games use the labels. I only know how the format is structured and write the code to handle that.

The dev names don't have any weird characters before them. I presume there's a label API in the games and the game files refer to the dev names when they want to load a specific label.
 

Zarklord

Well-Known Member
Member
Joined
May 13, 2016
Messages
194
Trophies
0
Age
25
XP
268
Country
United States
@Zarklord I don't. There's no need for me to know how the games use the labels. I only know how the format is structured and write the code to handle that.

The dev names don't have any weird characters before them. I presume there's a label API in the games and the game files refer to the dev names when they want to load a specific label.
so you know how to match up the label to the string in your program right? well how is that done?
 

IcySon55

Leader of Fan Translators International
OP
Member
Joined
Mar 18, 2008
Messages
463
Trophies
1
Age
38
XP
2,261
Country
Canada
so you know how to match up the label to the string in your program right? well how is that done?
If I'm remembering correctly, the labels are three pieces of information.

1 byte string length
N bytes for the string
4 byte index (32bit unsigned int)

The labels give you an index into the TXT2 section which stores all the strings. After reading in the TXT2 section, you simply pull an entry out by index based on the labels.

Edit: You can also just https://github.com/IcySon55/3DLandMSBTeditor/blob/master/MSBT.cs read the code. ;P
 

Zarklord

Well-Known Member
Member
Joined
May 13, 2016
Messages
194
Trophies
0
Age
25
XP
268
Country
United States
If I'm remembering correctly, the labels are three pieces of information.

1 byte string length
N bytes for the string
4 byte index (32bit unsigned int)

The labels give you an index into the TXT2 section which stores all the strings. After reading in the TXT2 section, you simply pull an entry out by index based on the labels.

Edit: You can also just https://github.com/IcySon55/3DLandMSBTeditor/blob/master/MSBT.cs read the code. ;P
so one question where do i apply the 4 byte index to the txt2 section?
 

IcySon55

Leader of Fan Translators International
OP
Member
Joined
Mar 18, 2008
Messages
463
Trophies
1
Age
38
XP
2,261
Country
Canada
so one question where do i apply the 4 byte index to the txt2 section?
You don't.

TXT2 holds all strings in order. LBL1 ties each label to its respective TXT2 entry via an index (position) in the ordered list of TXT2 entries.

What are you trying to do exactly because your questions don't seem to be getting anywhere?

If you're trying to add a new label entry. Doing it manually is not easy. Very not easy. My current code doesn't do it properly yet.
 
Last edited by IcySon55,

Zarklord

Well-Known Member
Member
Joined
May 13, 2016
Messages
194
Trophies
0
Age
25
XP
268
Country
United States
You don't.

TXT2 holds all strings in order. LBL1 ties each label to its respective TXT2 entry via an index (position) in the ordered list of TXT2 entries.

What are you trying to do exactly because your questions don't seem to be getting anywhere?
im trying to figure out how to add msbt labels and strings for smash 4 modding...

Edit:so i would go the 84th(hex) string to get that result right?
Edit2: got it go to the 4 byte index + 1 to get string number...
 
Last edited by Zarklord,

IcySon55

Leader of Fan Translators International
OP
Member
Joined
Mar 18, 2008
Messages
463
Trophies
1
Age
38
XP
2,261
Country
Canada
im trying to figure out how to add msbt labels and strings for smash 4 modding...

Edit:so i would go the 84th(hex) string to get that result right?

It is not currently possible to add new labels properly. You can try it but the game will not load the string. You have to calculate the label group value for the string you are adding and then increase the count of labels for that group by 1. I also think that the labels may need to be in order (likely alphabetical) and then all of the relocated strings would change the indexes for all of the labels.

Basically, you are not going to be able to add a new string via hex editing alone. I do have a version of MSBT Editor with an early attempt at adding new labels but it has been tested with Smash and doesn't work, yet.

When I find the time, I'll likely be working on this exact feature but I'm swamped atm with real life.
 
  • Like
Reactions: I pwned U!

Zarklord

Well-Known Member
Member
Joined
May 13, 2016
Messages
194
Trophies
0
Age
25
XP
268
Country
United States
I've Currently Cheesed The Second(Female) Villager Tag To Be Pikmin's Tag and in your editor it shows up fine see: Capture.PNG but in game it freaks out like not loading tags after the first pikmin 02 reference(i believe) could it be something to do with txt2 text pos or something else?
 

IcySon55

Leader of Fan Translators International
OP
Member
Joined
Mar 18, 2008
Messages
463
Trophies
1
Age
38
XP
2,261
Country
Canada
Did you change the name of one of the labels? You can't do that. It doesn't work.

Like I said, adding new labels is not currently possible. Especially manually.
 

Zarklord

Well-Known Member
Member
Joined
May 13, 2016
Messages
194
Trophies
0
Age
25
XP
268
Country
United States
Edit: @Kinnay clarified the checksum. You'll need to AND the value with 0xffffffff before doing the modulo, since the 3DS and Wii U only handle 32 bits of data. I sent IcySon55 detailed information on how to add new entries, now that we can move forward with validating them.
can you send me them as well?
 

IcySon55

Leader of Fan Translators International
OP
Member
Joined
Mar 18, 2008
Messages
463
Trophies
1
Age
38
XP
2,261
Country
Canada
This was useful: http://rhcafe.us.to/?page=wiki&id=MSBT_(File_Format)

C# Function to determine the label group:
Code:
public uint LabelChecksum(string label)
{
    uint group = 0;

    for (int i = 0; i < label.Length; i++)
    {
        group *= 0x492;
        group += label[i];
        group &= 0xFFFFFFFF;
    }

    return group % LBL1.NumberOfGroups;
}


Good luck. Properly rearranging the labels just to add one will be a real pain to do manually.
 

Zarklord

Well-Known Member
Member
Joined
May 13, 2016
Messages
194
Trophies
0
Age
25
XP
268
Country
United States
This was useful: http://rhcafe.us.to/?page=wiki&id=MSBT_(File_Format)

C# Function to determine the label group:
Code:
public uint LabelChecksum(string label)
{
    uint group = 0;

    for (int i = 0; i < label.Length; i++)
    {
        group *= 0x492;
        group += label[i];
        group &= 0xFFFFFFFF;
    }

    return group % LBL1.NumberOfGroups;
}


Good luck. Properly rearranging the labels just to add one will be a real pain to do manually.
thx before this i was 101 tries to get it right...
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: https://youtu.be/MddR6PTmGKg?si=mU2EO5hoE7XXSbSr