shizukachan / atelier_pak_decrypt

Koei Tecmo GUST PC ports archive decrypter / unpacker
Other
71 stars 41 forks source link

.e files decrypt\encrypt (Tool for full translation) #2

Open makc-ar opened 6 years ago

makc-ar commented 6 years ago

How about .e to .xml and back converter?

I found .bat to enc.exe official tool in archive Atelier Sophie The Alchemist of the Mysterious Book for %%X in (.e) do ....\enc\enc -d %%X for %%X in (.xml) do ....\enc\enc -e %%X

Example .e and .xml Atelier Lydie & Suelle The Alchemists and the Mysterious Paintings https://zenhax.com/download/file.php?id=4347

shizukachan commented 6 years ago

I'll look into it when I have time.

LiEnby commented 5 years ago

These files are not encrypted, there compressed.

0x3 has magic number? seems to be always 0x02 0x5 int32 of uncompressed data size 0x10 is the compressed data

im not sure what compression algorithm it uses, i tried some basic zlib on it and it didn't seem to work its possible its encrypted and compressed.

VitaSmith commented 4 years ago

"Ask, and you shall receive..."

I have now completed a full blow encoder/decoder for Gust .e file, called gust_enc, which you can find as part of my suite of Gust tools, here.

You can download a zip file, that includes gust_enc.exe for Windows, from the same place as well.

If you use that say, against Atelier Sophie's saves\library\LibraryMonster.xml.e you will then be able to produce interesting little things like this:

Image2

This was quite an interesting challenge, because Gust really appear to have gone all out on the scrambling of their data, so that sure kept me busy for a few days. If you are interested in that kind of thing, you can find a primer on how these whole .e files are created here.

The one thing you should know however is that each game uses a different set of encoding seeds, that need to be provided to be able to encode/decode a file. These are provided in a separate gust_enc.json file, that must reside in the same directory where you have gust_enc, and you will either need to update the default seeds_id in this file, or pass an option like -A19 (Atelier Lydie & Suelle), -BR (Blue Reflection), etc., to decode/encode for the relevant game.

Oh, and since I have preordered Atelier Ryza), I will update the utility to add the seeds for that game when it comes out (that is provided Gust haven't changed their encoding scheme there).

I'll also point out that the tools also provide separate utilities to extract/recreate .pak, .elixir[.gz] and .g1t archives. The .pak one, which is derived on @shizukachan's work (thanks!!) also automatically detects whether a 32-bit .pak (A17) or 64-bit .pak (A18 and later) should be extracted.

Enjoy! 😁

LiEnby commented 4 years ago

;) perhaps you can look into the custom texture compression used on the PSVita version of Atelier Nelke and such. (for stuff like translations?)

i tried with DXT5 and DXT1 but erh.. this happened: 2019-10-16-015516 2019-10-16-015502 2019-10-16-013522

Here are some of them for reference: ui.zip

shizukachan commented 4 years ago

From inspection it's a block texture compression format with 8bit/pixel, in 4x4 blocks. Since PowerVR SGX has support for both DXT5 and PVRTC, and PVRTC isn't a 4x4 block texture, my guess is some very simple swizzle or scrambling of DXT5 is going on.

VitaSmith commented 4 years ago

I wasn't really planning on looking at the non PC versions (because there are a few additional data types to handle and my time is not unlimited), so I only added support for the texture types I found in the PC games I tested.

Now, with regards to the files provided:

Extracting '20th_bg03.g1t'...
OFFSET   SIZE     NAME              DIMENSIONS MIPMAPS
ERROR: Unsupported texture type (0x12)

Yeah, this type 0x12 is mentioned as a swizzled Vita type in HyoutaTools: https://github.com/AdmiralCurtiss/HyoutaTools/blob/master/Gust/g1t/g1t.cs#L47

Steven's Gas Machine appears to have code that handles this in x_dw_g1t.cpp:

        // untile data
        boost::shared_array<char> untile(new char[filesize]);
        XGEndianSwapSurface(untile.get(), pitch, buffer.get(), pitch, dx, dy, D3DFMT_DXT5);
        swap(buffer, untile);
        XGUntileTextureLevel(dx, dy, 0, format, XGTILE_NONPACKED, untile.get(), pitch, NULL, buffer.get(), NULL);

However, what these calls actually do is all hidden in a pre-built xgraphics.lib, that doesn't seem to have its source public and I'm afraid I'm not familiar enough with textures and swizzling to have much of any idea what I'm supposed to do. I'm also not sure I want to spend a lot of time on trial and error trying to reinvent the wheel here. So if someone can provide a clear description of what's really needed (or even better, provide a patch -- the project is Open Source after all!), I'd appreciate it.

Also, I realize that the issue tracker had not been enabled for my fork, so I have fixed that. If you have other issues or enhancement requests regarding _gusttools, please make sure to report them in the project itself.

VitaSmith commented 4 years ago

To come back to the topic at hand, I am just going to mention that, as promised, I have now added the encoding seeds for Atelier Ryza to my .e utility:

Ryza

It's quite nice to be able to do that on release day. 😁

As expected, Koei Tecmo haven't changed much of anything, so the A18 unpacking method and the encoding/decoding of the .e files is the same (apart from requiring the new seeds). If you use gust_enc.exe remember to either use -A21 as parameter or set seeds_id to A21 in the .json file.

Oh and that game sure looks great!

VitaSmith commented 3 years ago

@KuromeSan, the files you provided in ui.zip should now all be supported in the latest release of gust_g1t:

000

000

JinYushiyuu commented 1 year ago

@VitaSmith I found text event files which is the .emb...

but where are the texts for all the rest of the game? such as the title of the quests, information that has texts of the quests and etc?

I found .xml files... but when editing them it doesn't work in the game, am I doing something wrong?

the event files have been working

Game: Atelier Ryza Ever Darkness & The Secret Hideout

VitaSmith commented 1 year ago

@JinYushiyuu:

I found .xml files... but when editing them it doesn't work in the game, am I doing something wrong?

You need to edit the .e not the .xml. The game uses the encrypted version of the .xml files, which are the .e files, and ignores the plain .xml files. Which means you need to use gust_enc from https://github.com/VitaSmith/gust_tools.

JinYushiyuu commented 1 year ago

@VitaSmith

I managed to see it here, the game pulls string from .xml.e, thanks anyway...

Thanks for taking the time to answer me, I'm translating the game into Brazilian Portuguese, few people are interested here because the country doesn't have a lot of knowledge in the English language.

maybe with a subtitle in Portuguese people are interested in the Atelier franchise, I'm in the process of editing the game's fonts to add the accents of the Portuguese language like ç, é, ú, ã, õ é á and etc...

as Koei's font is paid, can I edit them with .dds file easily or is it too complicated?

again, thank you very much for answering