Tool Localization Packer - Unpack and repack Terraria translation files

trigger_segfault

Spazmatism
wNK5dog.png

Terraria Localization Packer is a tool for unpacking and repacking Terraria translation files into the executable.
Translation files are stored in the .json text format.
About Localization Files

Terraria 1.4.2 has added support for Language Resource Packs!🎉 This removes the need to repack changed language files back in to Terraria. This tool is still useful for extracting the entire set of localization files in their JSON format.

NOTE: For anybody hosting in multiplayer, (this includes Steam Host & Play), make sure you repack the translation files into TerrariaServer.exe as well, the files stored in this program are identical to that in Terraria.exe so there is no need to make any changes.


vwCsvvm.png


Features

~ Unpack Terraria's localization files into their original .json format ~
~ Repack properly named localization files within the same folder back into Terraria ~
~ Atomatically creates a backup when repacking if one does not exist ~
~ Restore Terraria to the backed up executable ~

Requirements

.NET Framework 4.5.2 | Windows 7 or later
Terraria for PC

Downloads: v1.0.0.3

TerrariaLocalizationPacker-1.0.0.3.exe
(The main executable. Dlls in the previous downloads are no longer required)

~ Previous downloads can be found at the bottom of the page ~

vwCsvvm.png


Preview
au18vVx.png

Wiki | Credits | Image Album | Source Code

vwCsvvm.png


⬅ Other Information

v1.0.0.3
  • Fixed issue with Terraria 1.4 causing repacking to fail.
  • Improved stability with repacking in general.
  • Any failure to repack resulting in an executable filesize of 0 will automatically restore from backup.
v1.0.0.2
  • Now launches Terraria from the configured save folder in Terra Launcher if present on the computer.
  • Every required file and dll is now embedded into the executable.
  • Now waits half a second before making the executable large address
    aware. This should fix an issue where it couldn't write to the exe
    because it wasn't closed by the patching library yet.
  • A bit of code refactoring.
v1.0.0.1
  • Repacked executables are now large address aware which will prevent out of memory exceptions.
  • Now asks if you'd like to unpack.
v1.0.0.0

Unpack and repack translation files from the Terraria executable. Also includes restore option.
 
Last edited:
Thank you for this tool!
I have translated few hundred strings in the English files, then started the game and loaded a world.
CRASH.
terafail.PNG

This appeared after a normal message "Load failed."
When I try different worlds, they load correctly and the game is translated.
I have no idea what makes it crash in this single world, but it is my son's world, and the reason for me translating the game.

Any ideas? I can pack the language files for debugging for you if you want.
 
Thank you for this tool!
I have translated few hundred strings in the English files, then started the game and loaded a world.
CRASH.
View attachment 183398
This appeared after a normal message "Load failed."
When I try different worlds, they load correctly and the game is translated.
I have no idea what makes it crash in this single world, but it is my son's world, and the reason for me translating the game.

Any ideas? I can pack the language files for debugging for you if you want.

If you could send me the world and translation files that would be great. I think the issue is I didn't make the executable large address aware which I thought wouldn't be needed for resource modification. I also have a test download with that fix if you'd like to try it out. Make sure to make backups of your saves though.

TerrariaLocalizationPacker-test.zip

I wasn't able to reproduce the bug with my medium chest limit world or a large world, however I haven't made any changes to the translations before repacking.

It's also possible that this is related to a syntax error in the formatting of the language files but the fact that it worked in other worlds is suspicious. I can check over the files for you to see if I can find anything.

Also it's really great of you to translate the game just for your son. :D
 
It works!
While I prepared the files for you the large-address-aware version worked for me.

Yesterday I spent 2 hours translating some basic strings. Luckily he hasn't reached even first boss, so the quantity of relevant strings is small at this moment.

Anyway, THANK YOU!
 
Hello.
It works for 1.4? I can unpack files and change them, but when i try repack it, take an error. Terraria.exe get 0 bytes size after that.
I attach the file with an error.
 

Attachments

  • Exception.txt
    2.2 KB · Views: 216
Found the cause, and confirmed the solution.
The resource names changed up a bit with the latest releases (except for localization files, :happy:). The name changes were throwing off the EmbeddedAssemblyResolver needed for the libraries stored within Terraria.exe

Currently Terraria now searches for its embedded assemblies by checking if a resource name ends with the requested assembly.Name + ".dll", so Localization Packer will need to do the same.

Hotfix should be submitted sometime tomorrow ...err-today in 12+ hours. I still need to ensure backwards compatibility with 1.3.5, and handle one other minor issue. (aka, Localization Packer isn't restoring the Terraria.exe.bak after a failed Repack, leaving the executable in a not-so-useful state of an empty file. o_O)

Edit: Release is live!
 
Last edited:
Do i need to put the tool somewhere in particular? both this and the other item modifier tool give me the same error about the format of the exe or some dll being wrong
the language packer suddenly worked in a random attempt, but i didn't manage to get it to work anymore, could it be that i need to downgrade my .net framework or something like that?
 
Do i need to put the tool somewhere in particular?
No, I don’t think so, it works for me even from downloads folder.
both this and the other item modifier tool give me the same error about the format of the exe or some dll being wrong
the language packer suddenly worked in a random attempt, but i didn't manage to get it to work anymore, could it be that i need to downgrade my .net framework or something like that?
Maybe .exe file has been corrupted? Try verify integrity of game files in steam.
 
No, I don’t think so, it works for me even from downloads folder.

Maybe .exe file has been corrupted? Try verify integrity of game files in steam.
I have done so 4 times already and i wiped and re-installed once too, exact same error
After some googling it says that using a newer version of framework than the thing was made with can cause that issue, but there doesn't seem to be a way to install an older version since the installer will straight up refuse to do so cuz "A newer version is already installed"
 
After some googling it says that using a newer version of framework than the thing was made with can cause that issue, but there doesn't seem to be a way to install an older version since the installer will straight up refuse to do so cuz "A newer version is already installed"

Then, try install developer pack, installation should start even if you have higher version Download .NET Framework 4.5.2 Developer Pack Offline Installer
 
Then, try install developer pack, installation should start even if you have higher version Download .NET Framework 4.5.2 Developer Pack Offline Installer
ffs not even their support mention that it exists
thx a lot, i went for TT2 since it has the same item tweaking feature and i was just :red:ing around with the lang stuff anyway (haha name crimson heart to bloody :red: am veri funni), but this looks beyond useful considering the amount of problems i've had with framework in my previous PC
 
Do i need to put the tool somewhere in particular? both this and the other item modifier tool give me the same error about the format of the exe or some dll being wrong
the language packer suddenly worked in a random attempt, but i didn't manage to get it to work anymore, could it be that i need to downgrade my .net framework or something like that?

I think I may have a guess at what's going.

First, the .NET framework shouldn't ever be an issue, if you're able to play Terraria (on Windows), then the program should be able to function.

But previously when the patchers failed (at least this one). They would leave the Terraria.exe program in an unusable state. Both programs rely on Terraria.exe.bak to restore from. And that could also have been backed up from an unusable state.

If you're on Steam. Try revalidating game cache. Otherwise try reinstalling. Afterwards, could you go to where Terraria is installed and delete Terraria.exe.bak? This is an issue with how the backups are done by the patchers and they don't go very far to confirm the backup is usable.
 
Last edited:
I think I may have a guess at what's going.

First, the .NET framework shouldn't ever be an issue, if you're able to play Terraria (on Windows), then the program should be able to function.

But previously when the patchers failed (at least this one). They would leave the Terraria.exe program in an unusable state. Both programs rely on Terraria.exe.bak to restore from. And that could also have been backed up from an unusable state.

If you're on Steam. Try revalidating game cache. Otherwise try reinstalling. Afterwards, could you go to where Terraria is installed and delete Terraria.exe.bak? This is an issue with how the backups are done by the patchers and they don't go very far to confirm the backup is usable.
I think i answered this in a different thread, but i already did all of that, wiped the folder twice before re-installing, validated the cache at least 3 times, copied all the files to a folder in the other hard drive and re-tried the process
The thing is that the program fails the first time and gives an error, THEN the next time i try to press patch or restore (regardless of order) it gives that other error
Quoting my other post on another of your tools (the item modifier one, since it gives the same error in the same manner)


System.BadImageFormatException: El formato del archivo ejecutable (.exe) o de la biblioteca (.dll) no es válido. (translation: the format of the executable (.exe) or of the library(.dll) is invalid)
en Mono.Cecil.PE.ImageReader.ReadImage()
en Mono.Cecil.PE.ImageReader.ReadImageFrom(Stream stream)
en Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
en Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
en TerrariaItemModifier.Patching.Patcher.Patch()
en TerrariaItemModifier.MainWindow.OnPatch(Object sender, RoutedEventArgs e)
Update: seems like the tool creates the itemmodifications dll but turns the terraria exe into a 0B file, it also gives the same error when pressing restore, regardless of whether there's something to restore or not
It also gives a different error the FIRST time any of the buttons are pressed with something along the lines of "Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)" and something about PublicToken=null
 
Back
Top Bottom