ROM Hack [Release] msbt editor

schrmh

Well-Known Member
Newcomer
Joined
Jun 5, 2015
Messages
55
Trophies
0
XP
569
Country
Gambia, The
Why can't MSBT files be hex edited? When hex editing one, it doesn't work properly.
Hex editing msbt files should work because hex editing message_EU_LZ.bin (from system settings app) and extracting mset.msbt with the same content works. Maybe you are just not using the right tool to inject your msbt file back.

/Edit: Seems like this isn't your problem. Please give more details if you ask questions in the future..
 

Attachments

  • you_can_hexedit.png
    you_can_hexedit.png
    108 KB · Views: 550
Last edited by schrmh,

exelix11

Developer
OP
Developer
Joined
Feb 25, 2015
Messages
915
Trophies
1
Location
C:\users\exelix11\
XP
3,062
Country
Italy
Why can't MSBT files be hex edited? When hex editing one, it doesn't work properly.
If you overwrite the text that there's already in the file it will work, but if you add or remove characters from the string, you'll need to fix the other addresses in the file and the size of the section, this app makes everything automatically
 

DarkFlare69

Well-Known Member
Member
Joined
Dec 8, 2014
Messages
5,147
Trophies
2
Location
Chicago
XP
4,750
Country
United States
If you overwrite the text that there's already in the file it will work, but if you add or remove characters from the string, you'll need to fix the other addresses in the file and the size of the section, this app makes everything automatically
Not for me. I didn't remove any characters or anything, just changed them.



I'll test this tool on sm3dl today
 

Wander's Hat

Well-Known Member
Newcomer
Joined
Aug 18, 2015
Messages
63
Trophies
0
XP
135
Country
United States
This is a very, very nice tool (although I have to disable my Windows Defender since it's detected as a virus) but I need to ask, how do you put these files into the decompressed LZ.bin files? I know how to hex-edit the decompressed file and make the RomFS, but getting the files into the decompressed LZ.bin is another story.
 

exelix11

Developer
OP
Developer
Joined
Feb 25, 2015
Messages
915
Trophies
1
Location
C:\users\exelix11\
XP
3,062
Country
Italy
This is a very, very nice tool (although I have to disable my Windows Defender since it's detected as a virus) but I need to ask, how do you put these files into the decompressed LZ.bin files? I know how to hex-edit the decompressed file and make the RomFS, but getting the files into the decompressed LZ.bin is another story.
In the main window click on LZ compression, click decompress file, select you file, it will be saved as a bin file (the file extension doesn't matter it's just to make it different from the original file), open and edit it, then click on compress file, select it again and you'll have a .lz file that is your edited msbt compressed,then change the name and the file extension to match the file you are replacing.
 

Wander's Hat

Well-Known Member
Newcomer
Joined
Aug 18, 2015
Messages
63
Trophies
0
XP
135
Country
United States
In the main window click on LZ compression, click decompress file, select you file, it will be saved as a bin file (the file extension doesn't matter it's just to make it different from the original file), open and edit it, then click on compress file, select it again and you'll have a .lz file that is your edited msbt compressed,then change the name and the file extension to match the file you are replacing.

I've managed to do that just fine (I compressed/de-compressed a System Settings message LZ file) - sorry if I misworded anything. It's when I'm placing edited MSBT files back into the decompressed LZ.bin file. I'm not too sure on how one places the file back in, using a pre-made utility or manually.

e.g. If you look inside the decompressed System Settings message_EU_LZ.bin file in 3DSExplorer, you can see different files. I managed to extract, let's say, hud.msbt and I edited a few strings using this utility, but the challenge is placing it back in the decompressed file.

EDIT: Got them unpacked using pk3DS, however pk3DS will not repack into a DARC. I am using The DARC Tool (a Python script) and seeing if that works.
 
Last edited by Wander's Hat,
  • Like
Reactions: schrmh

SomeGamer

Well-Known Member
Member
Joined
Dec 19, 2014
Messages
6,827
Trophies
1
XP
4,902
Country
Hungary
Just a suggestion, the editor could auto-place the unused parts of the images and rotate, greyscale and remove the alpha channel of the top screen animated bg.
 

exelix11

Developer
OP
Developer
Joined
Feb 25, 2015
Messages
915
Trophies
1
Location
C:\users\exelix11\
XP
3,062
Country
Italy
I've managed to do that just fine (I compressed/de-compressed a System Settings message LZ file) - sorry if I misworded anything. It's when I'm placing edited MSBT files back into the decompressed LZ.bin file. I'm not too sure on how one places the file back in, using a pre-made utility or manually.

e.g. If you look inside the decompressed System Settings message_EU_LZ.bin file in 3DSExplorer, you can see different files. I managed to extract, let's say, hud.msbt and I edited a few strings using this utility, but the challenge is placing it back in the decompressed file.

EDIT: Got them unpacked using pk3DS, however pk3DS will not repack into a DARC. I am using The DARC Tool (a Python script) and seeing if that works.

To inject files into a darc you must use this: https://gbatemp.net/threads/release-a-darc-tool-for-nintendo3ds.385945/

Just a suggestion, the editor could auto-place the unused parts of the images and rotate, greyscale and remove the alpha channel of the top screen animated bg.
?
 

Reserved

Well-Known Member
Member
Joined
Mar 14, 2015
Messages
217
Trophies
0
Age
30
XP
227
Country
United States
Oh, by the way, if you actually do decide to try and work on .umsbt...

Alright ladies and gentlemen; a short guide to point you in the right direction, for as much time as I have today. If this is still super-confusing I'll try to get some pictures and be more specific. As I said before, I'm going to assume these principles would apply to any script file, but the one I used was STR_NNpc_name.umsbt found in the Script/Str folder of RomFS.

The structure of the file starts off with a large chunk of data that includes the villager code references. I'm not sure what this does, I tried to swap two of them and it broke their names entirely. Anyway, beyond that is a large zero set, and then at offset 288E starts another chunk of data that includes the villager names. If you're editing the US English names, this is where you want to be. The large group preceding the actual names is in fact references to where each name starts. However, they don't have any actual reference to the file in hex that I can tell, so they're basically internal pointers that you have to edit relative to each other. The pointers are two bytes, separated by 3 "00" bytes each. The first name "Cyrano" has the address 0C 07. If you look at the pattern of numbers, you can find that the address works as "Small Address" "Large Address" In other words the first byte increments from 00 to FF, at which point the second byte increments by 1.

Now, the decimal difference between one address and the next tells you how many bytes that name is allotted. Looking at the first two addresses, 1A minus 0C gives you 14 in decimal, and since the first name is Cyrano, that makes sense, as each name is allotted twice as many bytes as letters in the name, plus 2.

Okay, fair enough. But there's a monkey in the mix. Notice that some names have extra blanks after them? Well, each extra set of two bytes following the names also has an address in the table at the start here. So you can't just count off names and count down the addresses. You have to count the extra blanks as well to find the address of the name you want to expand. I used a spreadsheet with some repeated formulas to work this all out.

THEN, once you know the offset of the name you want to expand you're ready to go. Add in as many bytes as you need to finish the name (Remember you need 2 bytes for each extra letter). Now, you need to increase the offset for each FOLLOWING entry by the number of bytes you added. How far you have to go in doing this depends on what you want to do exactly, you have some options...
1 - shorten another name later in the list to balance out (remember to delete the same number of bytes later on, not just "00" the characters).
2 - come to one of the gaps with blank entries and delete enough bytes to balance out (as far as I can tell, the blank entries are not used, so it doesn't matter where they reference exactly and it's okay if a previous name overlaps them some)
3 - just increase the pointers until the end of the list.

I should point out that this same technique works in Happy Home Designer, except that (2) is not an option since it has no empty entries.

Hope this helps someone else! Feel free to ask for clarification

This info is probably going to be helpful.
 
  • Like
Reactions: I pwned U!

exelix11

Developer
OP
Developer
Joined
Feb 25, 2015
Messages
915
Trophies
1
Location
C:\users\exelix11\
XP
3,062
Country
Italy
It isn't working with MK7 msbt, it gives an unhandled exception. :unsure:
They may be compressed, try to LZ decompress them first

EDIT: Looks like they don't have the LBL1 section, the first version of MSBTeditor works on them, but the strings inside don't have names (i just tested the "0x0F869004" file found inside \UI\menu-en.szs)
 
Last edited by exelix11,

IcySon55

Leader of Fan Translators International
Member
Joined
Mar 18, 2008
Messages
463
Trophies
1
Age
38
XP
2,261
Country
Canada
Hey everyone (especially @exelix11),

Just chiming in with my own heavily modified version of @exelix11's excellent tool. If I should start a new thread for this, please have this post moved. :)

preview.png


I've only tested with MSBT files from one game, which I am translating. Can you guys guess which one? ;P

Bug reports are welcome of course.

Download v0.4 Alpha

GIT Hub Fork
Enjoy!
 
Last edited by IcySon55,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: https://twitter.com/TakiUdon_/status/1784139240328310955?cxt=HBwW1sLVmfbLxMIxAAAA&cn=ZmxleGlibGVf...